From 971d7a9d1607dc16c37276fc68364a3fb6ad42c1 Mon Sep 17 00:00:00 2001 From: Jose Buitron Date: Mon, 2 Dec 2024 13:22:11 -0500 Subject: [PATCH] fix: Avoid changing initial location after component mounts --- src/gis/components/Map.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gis/components/Map.js b/src/gis/components/Map.js index 0196a18b6..eb01767a2 100644 --- a/src/gis/components/Map.js +++ b/src/gis/components/Map.js @@ -305,7 +305,7 @@ const Map = React.forwardRef((props, ref) => { id, mapStyle, projection, - initialLocation, + initialLocation: propsInitialLocation, interactive = true, hash = false, attributionControl = true, @@ -325,6 +325,7 @@ const Map = React.forwardRef((props, ref) => { const { map, setMap } = useMap(); const mapContainer = useRef(null); const [bounds] = useState(initialBounds); + const [initialLocation] = useState(propsInitialLocation); useEffect(() => { const validBounds = isValidBounds(bounds);