We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 20aac5d commit 1beda3eCopy full SHA for 1beda3e
1 file changed
client/src/features/tasks/components/dnd/SortableList.tsx
@@ -56,11 +56,7 @@ const SortableList = () => {
56
const overIndex = previousTasks.findIndex(({ id }) => id === over.id);
57
const newOrder = arrayMove(previousTasks, activeIndex, overIndex);
58
queryClient.setQueryData<TaskProps[]>(['tasks', listId], newOrder);
59
- const minIndex = Math.min(activeIndex, overIndex);
60
- const maxIndex = Math.max(activeIndex, overIndex);
61
- const items = newOrder
62
- .slice(minIndex, maxIndex + 1)
63
- .map((task, i) => ({ id: task.id, position: minIndex + i }));
+ const items = newOrder.map((task, index) => ({ id: task.id, position: index }));
64
reorderTasks.mutate({ items, listId, previousTasks });
65
}
66
setActive(null);
0 commit comments