Describe the bug
I get incorrect behavior when i move items to neighbor block, after resort items with method sort()
var order = sortable.toArray();
sortable.sort(order.reverse(), true); // apply
To Reproduce
Steps to reproduce the behavior:
If we have two or more sortable blocks, and one of them has resort method before save
like this
const sortableOptions2 = {
animation: 250,
swapThreshold: 1,
group: "shared",
store: {
set: function (sortable) {
var order = sortable.toArray();
sortable.sort(order.reverse(), true); //in my project other - more difficulty sort, "reverse()" here just for simply demostration
}
}
};
We shuffle items with dnd inside our block or move them to another block and put them back to first
We need to make sure that our sortable.sort() has been done few times
After that all, we try to move items to neighbor block, and usually we see that instead dragable item, we get absolutly incorrect item in neighbor block and our dragable item stayed at his place (in first block)
Expected behavior
Of course i want to see correct item in neighbor block (dragable item). And i need to save resort items after every dragable.
Information
Versions - Look in your package.json for this information:
react-sortable = ^6.0.0
react = ^17.0.2
Describe the bug I get incorrect behavior when i move items to neighbor block, after resort items with method sort()
To Reproduce Steps to reproduce the behavior:
If we have two or more sortable blocks, and one of them has resort method before save like this
We shuffle items with dnd inside our block or move them to another block and put them back to first
We need to make sure that our sortable.sort() has been done few times
After that all, we try to move items to neighbor block, and usually we see that instead dragable item, we get absolutly incorrect item in neighbor block and our dragable item stayed at his place (in first block)
Expected behavior Of course i want to see correct item in neighbor block (dragable item). And i need to save resort items after every dragable.
Information Versions - Look in your
package.json
for this information: react-sortable = ^6.0.0 react = ^17.0.2Additional context SANDBOX
I also tryed to do something like this without react-sortablejs (only with pure SortableJS), and everything was good as i remember