docs(agents): record map pin rendering perf fix (signature guard + batched addLayers)

This commit is contained in:
SkateSpots 2026-09-29 12:47:46 +07:00
parent 563d91504d
commit 120c76b052

View file

@ -522,6 +522,21 @@ session with **no other memory of this project**. So:
hand. Publishing with no photo is allowed; the spot stays **Unverified**
(`SpotDetailPage` badge), the success toast says so, and the review queue's
'no photo' flag lets a human look later. The pre-submit checklist still nudges.
- **Map pin rendering (perf, 2026-09-29):** the spot/tour/event/crew marker
effect in `SpotMap.tsx` used to `clearLayers()` + rebuild **every** marker
whenever the parent handed it fresh arrays, and added each marker with a
per-marker `clusterGroup.addLayer()` (each call re-clusters the whole set) —
several synchronous full rebuilds per load on a few-hundred-pin map. Now:
(1) a **marker signature** (group geohash + spot/listing event ids + weather
colour/icon + layer toggles) short-circuits the effect when nothing that
affects the rendered pins changed — ids are enough because spot/listing/tour/
event/crew are all **addressable** (a new id on every edit), so unrelated array
churn (trust scores, comment/zap totals, re-sorts) no longer rebuilds the map;
(2) markers are collected and added with the plugin's bulk **`addLayers()` in
`requestAnimationFrame` batches of 150**, cancelled on effect re-run. One
cluster refresh per batch, pins paint progressively, main thread stays free.
**If you change what a marker renders, add it to the signature** or the update
will be skipped. `showSpots/showShops/showGear` are now effect deps.
- **Empty-map nudge (2026-09-28):** `MapPage` distinguishes the two empties — the
existing "No spots match" card is for *filters* (`filteredSpots.length === 0 &&
allLocations.length > 0`) and a new "No spots mapped yet — be the first" card