fix: prevent double-swap ping-pong during relay drag

After swapping with an adjacent item, the dragOffset adjustment can
flip its sign (e.g. negative becomes positive), which immediately
triggers the second if-block to swap back in the opposite direction
within the same onDrag call. This causes the dragged item to jump
and the user to end up dragging a different item. Fix by returning
after each successful swap so only one swap occurs per drag event.

https://claude.ai/code/session_01RVM5kEJGrCaJTaP3GmVHDd
This commit is contained in:
Claude
2026-04-06 18:29:25 +00:00
parent a092e78e8b
commit 8a64e218b8
@@ -71,6 +71,7 @@ class RelayDragState(
dragOffset += aboveHeight
draggedItemIndex = currentIndex - 1
return
}
}
@@ -87,6 +88,7 @@ class RelayDragState(
dragOffset -= belowHeight
draggedItemIndex = currentIndex + 1
return
}
}
}