From 120c76b052de7e585140d5622ac730e1eae90922 Mon Sep 17 00:00:00 2001 From: SkateSpots Date: Tue, 29 Sep 2026 12:47:46 +0700 Subject: [PATCH] docs(agents): record map pin rendering perf fix (signature guard + batched addLayers) --- AGENTS.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 11a6ce2..d3b8fba 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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