You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Avoided recreating all map markers when focusedProfileId changes
- Optimized using an O(1) `.setIcon()` imperative update instead of an O(N) re-render
- Added learning to `.jules/bolt.md`
Co-authored-by: KxlSys <116387953+KxlSys@users.noreply.github.com>
**Learning:** React Leaflet implementations often recreate all markers when a single property like `focusedProfileId` changes if dependencies are broad.
3
+
**Action:** When working with Leaflet markers in React, avoid putting the focused ID in the main layer creation dependency array. Instead, use a secondary `useEffect` to find the specific Leaflet marker instance and update its icon or state directly. This turns an O(N) DOM operation (recreating hundreds of markers) into an O(1) operation (updating just 1-2 markers), vastly improving interaction performance on maps with many points.
0 commit comments