map: don't re-fit bounds on every selection re-render (keep user zoom/pan) - #295
Draft
ivanmkc wants to merge 1 commit into
Draft
map: don't re-fit bounds on every selection re-render (keep user zoom/pan)#295ivanmkc wants to merge 1 commit into
ivanmkc wants to merge 1 commit into
Conversation
The PlacesExplorer <Map> called fitBounds at the end of an effect keyed on markers; any re-render that rebuilt the markers array (select/star/filter/ search) re-fit the view, snapping the user's pan/zoom back to the full extent — unusable after the first interaction. Now fit only when the marker SET changes (signature of sorted coords); selection/star re-renders keep the view. Adds e2e/map-view.e2e.mjs regression test (zoom in, then select twice, assert zoom held). A/B verified: fails on pre-fix code (zoom resets to fit), passes with the fix.
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.
PlacesExplorer's re-fit bounds on every effect run, so any re-render that rebuilt the markers array (selection/star/filter/search) snapped the view back to full-extent — the map was unusable after the first interaction.
Fix: fit bounds only when the marker SET changes (signature of sorted coords). Selection/star/hover re-renders now keep the current pan/zoom; filter/search (which change the shown set) still re-fit.
Verified with a new e2e (e2e/map-view.e2e.mjs) — zoom in, select twice, assert zoom held. A/B: fails on pre-fix code (zoom 19 → resets to fit 7 on select), passes with the fix (holds 19). Wired into the test:e2e chains. tsc clean.