Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marker jumps back to initial position during drag #2481

Open
Fabioni opened this issue Feb 4, 2025 · 0 comments
Open

Marker jumps back to initial position during drag #2481

Fabioni opened this issue Feb 4, 2025 · 0 comments

Comments

@Fabioni
Copy link

Fabioni commented Feb 4, 2025

If using onDragEnd to only update the internal app state when dragging is done instead of onDrag to constantly update it, the marker jumps back to the initial position whenever <Marker> rerenders even if none of the props changed.

I think this should not use marker.getLngLat() for comparison because this is update during draging but should save and use the last passed position from the caller.

if (marker.getLngLat().lng !== longitude || marker.getLngLat().lat !== latitude) {
marker.setLngLat([longitude, latitude]);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant