fix([2fd88f42]): definitively resolve infinite loop in dynamic legend

This commit is contained in:
2026-02-04 14:04:33 +00:00
parent e9416f1c82
commit 89fa639883

View File

@@ -22,13 +22,9 @@ const DynamicLegendHandler = ({ onBoundsChange }: { onBoundsChange: (bounds: Lat
const map = useMapEvents({
zoomend: () => onBoundsChange(map.getBounds()),
moveend: () => onBoundsChange(map.getBounds()),
load: () => onBoundsChange(map.getBounds()), // Handle initial load
});
// Initial load
useEffect(() => {
onBoundsChange(map.getBounds());
}, []); // Run only once on initial mount
return null;
};