dnd-kit icon indicating copy to clipboard operation
dnd-kit copied to clipboard

sortable: check over change before calling strategy

Open trungdo-epi opened this issue 2 years ago • 3 comments

useSortable should check if over has change before calling strategy.

https://github.com/clauderic/dnd-kit/blob/master/packages/sortable/src/hooks/useSortable.ts#L84

Currently, strategy is called for every rerender of DndContext.

trungdo-epi avatar Aug 04 '21 00:08 trungdo-epi

Can you elaborate on why this is a problem for your use-case?

clauderic avatar Aug 20 '21 16:08 clauderic

If I am not mistaken.

Currently, DndContext is rerendered on every drag move event. https://github.com/clauderic/dnd-kit/blob/master/packages/core/src/components/DndContext/DndContext.tsx#L359

But not every move event causes overId to change, i.e. over event is less frequent than move event. https://github.com/clauderic/dnd-kit/blob/master/packages/core/src/components/DndContext/DndContext.tsx#L278

If over event does not happen, then there is no need to recalculate transformation of droppable containers.

trungdo-epi avatar Aug 21 '21 12:08 trungdo-epi

any update @clauderic ?

VArsenyan avatar Feb 02 '22 09:02 VArsenyan