Skip to content

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

Open
@alex14vdk

Description

@alex14vdk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions