Show cached patches as blue boxes on the map#55
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a feature to visualize cached patches on the map, adding a toggle button in the navigation bar, updating the map overlay to render cached bounds, and implementing a subscription mechanism in ZarrChunkReader to track cache mutations. The review feedback highlights a fragile cache key parsing implementation that could fail if variable names contain colons, and suggests batching cache change notifications using queueMicrotask to prevent rapid, redundant re-renders during concurrent chunk loads.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
🚀 Vercel preview deployed Preview URL: https://earth-prints-guk9otaka-anastasiia-s-projects10.vercel.app |
Adds a third overlay layer that visualizes which patches are currently held in the in-memory LRU cache, so you can see the real footprint of what's been downloaded as you click around — not just the single active patch.
The colour story
The map now reads as a cool teal → blue → violet ramp, each hue a distinct role:
Blue boxes render beneath the violet patch and teal cell, so the active selection always stays on top.
How it works
ZarrChunkReadernow exposesgetCachedPatches()(distinct lat/lon patches, de-duplicated across time chunks) plus asubscribe()/getCacheVersion()pair, so the map updates reactively — including when background prefetch completes.chunkIndicesToPatchBounds()extracted fromchunkPatchBounds()to turn chunk indices straight into geo bounds.Verify
eslint,next build(incl. its TypeScript pass), andvitest(44 tests, +1 forchunkIndicesToPatchBounds) all pass.Base
Stacked on
38-patch-extent(#51) because it reuses that PR's violet patch tokens. Retarget tomainonce #51 merges.