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

[bug] Incorrect movement after resort items (with method sortable.sort) #215

Open
alex14vdk opened this issue Jul 26, 2021 · 0 comments
Open

Comments

@alex14vdk
Copy link

alex14vdk commented Jul 26, 2021

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:

  1. 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
    }
  }
};
  1. We shuffle items with dnd inside our block or move them to another block and put them back to first
  2. We need to make sure that our sortable.sort() has been done few times
  3. 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

Additional context
SANDBOX

I also tryed to do something like this without react-sortablejs (only with pure SortableJS), and everything was good as i remember

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