Skip to content

Commit

Permalink
Fix duplicate data when dragging items
Browse files Browse the repository at this point in the history
  • Loading branch information
Rochmar Nicolas (DevExpress) committed Apr 11, 2024
1 parent c87b89b commit 064c35f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/react/src/components/library/card-tasks/CardTasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ const Grid = ({ tasks }: { tasks: Task[] }) => {
const toIndex = gridData.indexOf(visibleRows[e.toIndex].data);
const fromIndex = gridData.indexOf(e.itemData);

setGridData([
...gridData.slice(0, fromIndex),
...gridData.slice(fromIndex + 1, toIndex + 1),
e.itemData,
...gridData.slice(toIndex + 1)
]);
const newGridData = [...gridData];
newGridData.splice(fromIndex, 1);
newGridData.splice(toIndex, 0, e.itemData);
setGridData(newGridData);
}, [gridData]);

return (
Expand Down

0 comments on commit 064c35f

Please sign in to comment.