Repository navigation
fix(map): cap the search zoom and open on the visitor's last or home view - #360
Merged
Merged
Conversation
…view A search that leaves one place fitted a zero-size box and zoomed to level 19, where the basemap is blank. The fit is now capped (16 for one place, 15 for several) and the go-to-place zoom shares one constant. The map used to open on the whole world with grey bands above and below the tiles. It now keeps the basemap covering the viewport with a minimum zoom, reopens where the visitor last left it (localStorage, guarded), and opens on a signed-in visitor's saved home when nothing else chose a view. An explicit lat/lng/zoom, place, search or filter in the URL still wins, and nothing asks for geolocation on load. Closes #350 Closes #353
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Nov 24, 2026
This branch was successfully deployed
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.
What this changes
Two map start-view bugs that share the same code.
#353, search zoomed to level 19.
?q=esenbogaleaves one place, andFitAllOnMountfitted a zero-size box around it with no cap, so Leaflet fell back to its maximum zoom, where the basemap is blank. The fit is now capped at zoom 16 for one place and 15 for several.FlyToPlaceuses the same shared constant, so search, list click and?place=follow one rule.#350, world view with grey bands.
localStorage, every read and write in try/catch).?lat&lng&zoom,?place=, search or filter in the URL still wins over all of the above. Nothing triggers a geolocation prompt on load.The shared rules live in
src/components/map/viewport.ts(no Leaflet or React in it) with their own tests.Type of change
Testing
npm run typecheck,npm run lint,npm run test:unitall pass locally.Not covered
/maptoday, and loading it is a separate change. The acceptance list does not require it.Closes #350
Closes #353