chore(react/collections/geomap): properly dispose

This commit is contained in:
Elian Doran
2025-09-04 21:50:45 +03:00
parent 3b66522a5e
commit 8bb8e011f3

View File

@@ -23,9 +23,15 @@ export default function Map({ coordinates, zoom, layerName, viewportChanged, chi
useEffect(() => { useEffect(() => {
if (!containerRef.current) return; if (!containerRef.current) return;
mapRef.current = L.map(containerRef.current, { const mapInstance = L.map(containerRef.current, {
worldCopyJump: true worldCopyJump: true
}); });
mapRef.current = mapInstance;
return () => {
mapInstance.off();
mapInstance.remove();
};
}, []); }, []);
// Load the layer asynchronously. // Load the layer asynchronously.