fix([2fd88f42]): definitively resolve infinite loop in dynamic legend
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user