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 <noreply@anthropic.com>
This commit is contained in:
Matt 2026-04-30 01:43:19 +00:00
commit 68f0a8dff7

View file

@ -1280,8 +1280,7 @@ const MapView = forwardRef(function MapView(_, ref) {
highlightedFeatureRef.current = null highlightedFeatureRef.current = null
} }
setSelectedHighlight(map, null) setSelectedHighlight(map, null)
// Clear old boundary before setting new place // Note: do not clear boundary here - new data replaces old when API returns
if (updateBoundaryRef.current) updateBoundaryRef.current(null)
if (labelFeature) { if (labelFeature) {
// Clicked a labeled feature snap to geometry and highlight // Clicked a labeled feature snap to geometry and highlight