fix: prevent marker snap-back during drag via PubSub echo #18

Merged
ryan merged 1 commits from worktree-drag-rate-limit into main 2026-02-21 02:51:40 +00:00
Owner

Summary

  • Add per-marker _dragging flag set on dragstart, cleared after dragend writeback
  • Guard the signal→position effect (setLngLat and rotation) to skip while _dragging is true
  • Prevents stale PubSub echo positions from snapping the marker back mid-drag

Test plan

  • go build ./internal/examples/maplibre and run the example
  • Open two browser tabs, drag the blue pin — should move smoothly without snapping back
  • Other tab should still receive live position updates
## Summary - Add per-marker `_dragging` flag set on `dragstart`, cleared after `dragend` writeback - Guard the signal→position effect (`setLngLat` and rotation) to skip while `_dragging` is true - Prevents stale PubSub echo positions from snapping the marker back mid-drag ## Test plan - [ ] `go build ./internal/examples/maplibre` and run the example - [ ] Open two browser tabs, drag the blue pin — should move smoothly without snapping back - [ ] Other tab should still receive live position updates
ryan added 1 commit 2026-02-21 02:50:05 +00:00
fix: prevent marker snap-back during drag via PubSub echo
All checks were successful
CI / Build and Test (push) Successful in 41s
CI / Build and Test (pull_request) Successful in 37s
a6d18273e9
When dragging a marker in a multi-client PubSub setup, the server echoes
position updates back to the originating client. The data-effect would
then call setLngLat with the stale echoed position, snapping the marker
back while the user had already dragged further.

Add a per-marker _dragging flag: set on dragstart, cleared after the
final dragend writeback. The signal→position effect skips setLngLat
(and rotation) while the flag is true.
ryan merged commit 5967ca3805 into main 2026-02-21 02:51:40 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ryan/via#18