Skip to content

fix: onDragEnd returning the old order after other items changed places - #649

Draft
MatiPl01 wants to merge 1 commit into
mainfrom
fix/order-items-stale-from-index
Draft

MatiPl01 wants to merge 1 commit into
mainfrom
fix/order-items-stale-from-index

Conversation

@MatiPl01

Copy link
Copy Markdown
Owner

Description

The reordered data (grid) and order (flex) passed to onDragEnd were the unchanged input whenever the dragged item ended at the index it started from. Other items can change places in the meantime (the swap strategy, or data changed during the drag), and the result then did not match the displayed order.

The check now compares the whole order. When nothing changed, the same array is still returned.

Testing

New jest test, fails on main.

Evidence
Test on main before-test-on-main.txt
Test with the fix after-test-with-fix.txt

@MatiPl01 MatiPl01 self-assigned this Nov 25, 2026
@vercel

vercel Bot commented Nov 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
react-native-sortables-docs Ignored Ignored Nov 25, 2026 7:40pm UTC

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant