diff --git a/src/app/signers/SignersHeader.tsx b/src/app/signers/SignersHeader.tsx index 8e499a1df..9ccd5c398 100644 --- a/src/app/signers/SignersHeader.tsx +++ b/src/app/signers/SignersHeader.tsx @@ -68,13 +68,6 @@ export function SignersHeaderLayout({ (markerLatLng); + + useEffect(() => { + prevMarkerLatLng.current = markerLatLng; + }, [markerLatLng]); + + // A new marker is clicked if the previous marker is undefined and the current marker is defined, or if the lat/lng of the current marker is different from the previous marker const newMarkerClicked = (prevMarkerLatLng.current === undefined && markerLatLng !== undefined) || (prevMarkerLatLng.current && markerLatLng && prevMarkerLatLng.current.lat !== markerLatLng.lat) || (prevMarkerLatLng.current && markerLatLng && prevMarkerLatLng.current.lng !== markerLatLng.lng); - useEffect(() => { - prevMarkerLatLng.current = markerLatLng; - }, [markerLatLng]); useEffect(() => { if (!newMarkerClicked) return; @@ -358,8 +361,6 @@ export function SignersMap({ maxBounds={BOUNDS} >