Prevent leaflet from resetting center and zoom when browser resizes #4265
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.
This PR tries to solve #4182 by changing the update mechanism for center and zoom yet again.
As it turned out, Vue's
updated()
lifecycle hook is not only called when a prop is updated from the server, but also when the window resizes (vertically). In this case the "center" and "zoom" props can be outdated if the user navigated the map manually. But the props are used to callsetView
, causing the map to reset to the last location sent from the server.Various test setups from this issue as well as previous issues seem to work just right: