diff --git a/src/components/PlayerMap.tsx b/src/components/PlayerMap.tsx index eec6971..d97cb83 100644 --- a/src/components/PlayerMap.tsx +++ b/src/components/PlayerMap.tsx @@ -7,6 +7,7 @@ import "leaflet.markercluster/dist/MarkerCluster.Default.css"; import type { Plext } from "../types"; import { useMapGeolocation } from "../hooks/useMapGeolocation"; import { useMapBounds } from "../hooks/useMapBounds"; +import { useEffect } from "react"; // Fix Leaflet marker icons delete (L.Icon.Default.prototype as any)._getIconUrl; @@ -86,6 +87,19 @@ export function PlayerMap({ plexts, onCenterChange, onRadiusChange }: PlayerMapP }) .filter(Boolean); + // Show markers after a short delay to allow clustering to complete + // This prevents individual markers from being visible before clusters are formed + useEffect(() => { + const timer = setTimeout(() => { + const markers = document.querySelectorAll('.leaflet-marker-icon:not(.marker-cluster)'); + markers.forEach((marker) => { + marker.classList.add('visible'); + }); + }, 100); // Small delay to allow cluster group to process markers + + return () => clearTimeout(timer); + }, [playerLocations]); + return (