Skip to content

Fix map layers skipping unloaded areas after panning - #8

Merged
DeanCron merged 1 commit into
mainfrom
deancron-ci-tests-and-runtime-upgrade
Oct 6, 2026
Merged

DeanCron merged 1 commit into
mainfrom
deancron-ci-tests-and-runtime-upgrade

Conversation

@DeanCron

@DeanCron DeanCron commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Bug

Viewport-driven layers tracked "already loaded" coverage as a single LatLngBounds grown with extend(). Loading two distant areas (e.g. NYC, then LA) produced one rectangle covering everything in between, so panning into that gap (e.g. Chicago) hit Skipping — bounds already loaded and markers were never fetched.

Fix

New src/map/loadedRegions.ts keeps the individual loaded boxes (capped at 32, oldest evicted, boxes swallowed by a larger load dropped). A load is skipped only when one box fully contains the viewport; partial overlap refetches, and existing known-ID sets dedupe markers.

Applied to: airports, Costco, data centers, EMS, crowd magnets, cameras, transit stops (rail + bus), transit lines, bus lines. Layers that already replace their bounds (superfund, flood, tornado, AQI, power) were correct and are unchanged.

Verification

  • 6 new unit tests in loadedRegions.test.ts, including the distant-pans gap case.
  • tsc -b, lint, 211/211 tests pass.

Viewport-driven layers tracked loaded coverage as a single LatLngBounds
grown with extend(). Loading two distant areas produced one rectangle that
also covered everything between them, so panning into that gap was treated
as "already loaded" and markers were never fetched.

Track the individual loaded boxes instead (capped at 32) and skip a load
only when one box fully contains the viewport. Applies to airports, Costco,
data centers, EMS, crowd magnets, cameras, transit stops/lines, and bus
stops/lines.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@DeanCron
DeanCron merged commit a9a50ac into main Oct 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant