From 8bb8e011f330776a8705d6b4b068d4b539a0fad3 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 4 Sep 2025 21:50:45 +0300 Subject: [PATCH] chore(react/collections/geomap): properly dispose --- apps/client/src/widgets/collections/geomap/map.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/client/src/widgets/collections/geomap/map.tsx b/apps/client/src/widgets/collections/geomap/map.tsx index bb4f22c03..6e1cb57f1 100644 --- a/apps/client/src/widgets/collections/geomap/map.tsx +++ b/apps/client/src/widgets/collections/geomap/map.tsx @@ -23,9 +23,15 @@ export default function Map({ coordinates, zoom, layerName, viewportChanged, chi useEffect(() => { if (!containerRef.current) return; - mapRef.current = L.map(containerRef.current, { + const mapInstance = L.map(containerRef.current, { worldCopyJump: true }); + + mapRef.current = mapInstance; + return () => { + mapInstance.off(); + mapInstance.remove(); + }; }, []); // Load the layer asynchronously.