Search code examples
reactjsanimationdrag-and-droptransformdnd-kit

dnd-kit sortable animation is triggering twice on DragEnd


When I swap two distant items on a grid it 'redoes' the swap animation (going backwards then forwards again). It works fine when the items are very near as you can see in the following gif:

I've followed the Sortable docs but I can't figure out why it is redoing the animation. I just want to drop it on the grid cell and keep the old item on the position it already is, not doing the animation over again

Here's the link to the code sample


Solution

  • Apparently I solved it setting animateLayoutChanges: () => false on the useSortable hook