diff --git a/components/observatory/observatory-map.tsx b/components/observatory/observatory-map.tsx index 0ede26b2..d73a5e46 100644 --- a/components/observatory/observatory-map.tsx +++ b/components/observatory/observatory-map.tsx @@ -119,6 +119,7 @@ export function ObservatoryMap({ selectedCountry }: ObservatoryMapProps) { const [isMounted, setIsMounted] = useState(false); + const [mapKey, setMapKey] = useState(Date.now()); // Unique key for map container // We'll need the Leaflet CSS useEffect(() => { @@ -154,6 +155,12 @@ export function ObservatoryMap({ } setIsMounted(true); + + // Return cleanup function + return () => { + // Generate a new key if the component is unmounted and remounted + setMapKey(Date.now()); + }; }, []); // Prepare countries with coordinates @@ -210,6 +217,7 @@ export function ObservatoryMap({ return (