From 91b90bfb493c45617081b0824f8608358cc6513c Mon Sep 17 00:00:00 2001 From: Collin Beczak Date: Fri, 5 Jun 2026 13:29:32 -0300 Subject: [PATCH] Fly map to selected Nominatim search result on Find Challenges The search result click only updated React/Redux bounds state; the Leaflet map view never moved, so the viewport stayed global and the "Intersects Map Bounds" filter reported no tasks. --- src/components/TaskClusterMap/TaskClusterMap.jsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/TaskClusterMap/TaskClusterMap.jsx b/src/components/TaskClusterMap/TaskClusterMap.jsx index 16baf85bc..1c1b84819 100644 --- a/src/components/TaskClusterMap/TaskClusterMap.jsx +++ b/src/components/TaskClusterMap/TaskClusterMap.jsx @@ -60,10 +60,21 @@ export const TaskClusterMap = (props) => { const { workspaceContext, setWorkspaceContext } = props; const [currentBounds, setCurrentBounds] = useState(null); const [searchOpen, setSearchOpen] = useState(false); + const [searchBounds, setSearchBounds] = useState(null); const [currentZoom, setCurrentZoom] = useState(); const [drawerOpen, setDrawerOpen] = useState(true); const [showPriorityBounds, setShowPriorityBounds] = useState(false); + const FlyToSearchBounds = () => { + const map = useMap(); + useEffect(() => { + if (searchBounds) { + map.fitBounds(searchBounds); + } + }, [searchBounds]); + return null; + }; + // Check if we have valid priority bounds data const hasPriorityBounds = () => { if (!props.challenge) return false; @@ -357,12 +368,15 @@ export const TaskClusterMap = (props) => { { - setCurrentBounds(toLatLngBounds(bounds)); + const latLngBounds = toLatLngBounds(bounds); + setSearchBounds(latLngBounds); + setCurrentBounds(latLngBounds); props.updateBounds(bounds); }} closeSearch={() => setSearchOpen(false)} /> )} +