Repository navigation
Fix map layers skipping unloaded areas after panning - #8
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
Viewport-driven layers tracked "already loaded" coverage as a single
LatLngBoundsgrown withextend(). Loading two distant areas (e.g. NYC, then LA) produced one rectangle covering everything in between, so panning into that gap (e.g. Chicago) hitSkipping — bounds already loadedand markers were never fetched.Fix
New
src/map/loadedRegions.tskeeps 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
loadedRegions.test.ts, including the distant-pans gap case.tsc -b, lint, 211/211 tests pass.