'React Drag and drop reordering bug
I have a weird bug that I'm trying to solve, sandbox here: https://codesandbox.io/s/drag-and-drop-with-reordering-test-i9f0j3
Basically, the reordering doesn't really work and I can't figure out why.
The bug (I think) has to do with my hooks.
To reproduce, drag 3 controls onto the canvas, one after another, and then put the last one above the middle one, which works correctly, and repeat, dragging the last one to be above the middle one, and the console prints out the same thing twice. It should reorder correctly.
The relevant files are going to be the Canvas that has the dropping callback, and the Dropzone where I pass the callback to the drop hook. The drop hook isn't getting the right controlToDrop.
Any insights as to what the heck is happening here would be very helpful.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|