From 68f0a8dff75d4c7c4137e6f99e99e2854a0b82d3 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 30 Apr 2026 01:43:19 +0000 Subject: [PATCH] fix(map): atomic boundary transition when switching places Remove the clear-then-set pattern when clicking a new labeled feature. Previously, clicking Kimberly after Twin Falls would: 1. Clear Twin Falls boundary 2. Set new place 3. Wait for API to return 4. Set Kimberly boundary This caused the old boundary to disappear before the new one was ready, requiring two clicks. Now when clicking a new labeled feature: 1. Set new place immediately 2. When API returns, updateBoundary(newData) replaces old data in-place The GeoJSON source only holds one dataset - setting new data naturally replaces old data. Explicit clear only needed when deselecting or clicking empty map. Co-Authored-By: Claude Opus 4.5 --- src/components/MapView.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/MapView.jsx b/src/components/MapView.jsx index 4f6c312..bc561d7 100644 --- a/src/components/MapView.jsx +++ b/src/components/MapView.jsx @@ -1280,8 +1280,7 @@ const MapView = forwardRef(function MapView(_, ref) { highlightedFeatureRef.current = null } setSelectedHighlight(map, null) - // Clear old boundary before setting new place - if (updateBoundaryRef.current) updateBoundaryRef.current(null) + // Note: do not clear boundary here - new data replaces old when API returns if (labelFeature) { // Clicked a labeled feature — snap to geometry and highlight