mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 08:15:52 +01:00
chore(react/collections/geomap): properly dispose
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user