Skip to content

Commit

Permalink
Use optimistic sorting for columns
Browse files Browse the repository at this point in the history
  • Loading branch information
clauderic committed Sep 21, 2024
1 parent 0c7bf85 commit 92676b4
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,23 @@ export function MultipleLists({
}

if (source.type === 'column') {
setColumns((columns) => move(columns, source, target));
// We can rely on optimistic sorting for columns
return;
}

event.preventDefault();
setItems((items) => move(items, source, target));
}}
onDragEnd={(event) => {
if (event.canceled) {
setItems(snapshot.current);
return;
}

const {source, target} = event.operation;

if (source?.type === 'column') {
setColumns((columns) => move(columns, source, target));
}
}}
>
Expand Down

0 comments on commit 92676b4

Please sign in to comment.