Repository navigation
fix: preserve map dragging with controlled camera props - #1108
Merged
Merged
Conversation
The camera hook now updates its tracked state immediately after calling moveCamera, including renders that occur before the map event arrives. A regression test verifies that unchanged controlled camera props do not trigger repeated moveCamera calls. Fixes visgl#425
[Medium impact] This PR appears safe to merge. SummaryThe camera hook now records requested camera changes immediately after
|
usefulthink
approved these changes
Oct 30, 2026
usefulthink
left a comment
Collaborator
There was a problem hiding this comment.
Thanks a lot, great find!
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.
Background
Maps using controlled camera props can stop responding to mouse dragging and other interactions after camera changes are fed back into state.
After applying controlled camera props, the tracked camera state was not updated until the map emitted its change event. A render occurring before that event could therefore reapply the same camera values repeatedly, interfering with interaction.
Summary of the fix
The camera hook now updates its tracked state immediately after calling moveCamera, including renders that occur before the map event arrives. A regression test verifies that unchanged controlled camera props do not trigger repeated moveCamera calls.
Verification
The map component test suite passes, including the regression test for repeated controlled camera updates.
Fixes #425