Skip to content

Rewrite /map marker rendering to unified client-side supercluster index#376

Open
badjoke-lab wants to merge 1 commit into
mainfrom
codex/replace-map-marker-rendering-with-supercluster-index
Open

Rewrite /map marker rendering to unified client-side supercluster index#376
badjoke-lab wants to merge 1 commit into
mainfrom
codex/replace-map-marker-rendering-with-supercluster-index

Conversation

@badjoke-lab

Copy link
Copy Markdown
Owner

Motivation

  • Improve pan/zoom responsiveness by making marker clustering local and immediate during map interactions.
  • Remove the brittle overview/place-level source switching so marker rendering is handled by a single client-side index.
  • Minimize payloads used for marker drawing so the renderer only needs { id, lat, lng, verification } and full Place objects are not used for marker layout.
  • Preserve existing place detail/list/drawer behavior and avoid DB/data/docs changes.

Description

  • Replaced the marker rendering flow in components/map/MapClient.tsx to maintain one supercluster index (clusterIndexRef) that is rebuilt on initial load and on filter changes and used for all move/zoom reclustering via getClusters(bounds, zoom).
  • Changed renderClusters to reuse existing Leaflet markers keyed by cluster:<id> / point:<id> and only remove stale items instead of wholesale layer replacement, reducing render churn and enabling smoother transitions.
  • Added a lightweight marker-only API route GET /api/places/pins implemented in app/api/places/pins/route.ts which returns minimal pin DTOs and reuses listPlacesForMap under the hood.
  • Made filter-driven marker fetch debounced (~60ms) so pins are fetched only on filters (and initial load), while pan/zoom uses local reclustering; kept places summary/detail fetches and list behaviour separate and intact.
  • Files changed: components/map/MapClient.tsx (marker/index/renderer rewrite, debounce, reuse logic) and app/api/places/pins/route.ts (new marker-only route).

Testing

  • Ran npm run lint, which completed successfully with only linter warnings reported.
  • Ran npm run test:stats, which failed in the CI-like test environment due to a test runtime module resolution error (Cannot find module '@/lib/db') unrelated to the map changes and preventing full test execution.
  • No browser/Playwright smoke runs were executed in this environment as part of this PR validation step.

Codex Task

@vercel

vercel Bot commented Mar 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cryptopaymap-v2 Ready Ready Preview, Comment Mar 23, 2026 2:59pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant