Closed revialim closed 4 years ago
After some more investigation I found out, that the item in the codesandbox sample doesn't get moved when trying to move it to first or last position, but jumps back to its previous position without index out of bounds error. In some cases visually it appears like the ids get reassigned.
Hi, I'm trying out the drag-and-drop for the first time and edited the functional example that was given in the docs to work as I'd like to use it. Now my problem occurs when I applied it to my own code I get some errors when I drag elements to the very beginning or very end of the list. When calling
reorder
quite logically there is no element in my list atendIndex
when dragging to the last position. In the codesandbox example, though, it seems to work anyways and all elements above have thesort
number updated as well. I would like to know what happens in the code, that I'm missing, to make it work on my local project as well.Expected behavior
Dragging element locally behaves the same as in the codesandbox example.
Actual behavior
Dragging element in local project causes undefined error since referencing list outside of scope.
My local workaround (below) works fine, so this is rather a question, why it doesn't cause a bug in the codesandbox example.