Skip to content

Commit

Permalink
fix(useSortable): order of dom and array is different
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfred-Skyblue committed Apr 2, 2023
1 parent 01a7ab4 commit 04c147e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/integrations/useSortable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ export function moveArrayElement<T>(
to: number,
): void {
const array = resolveUnref(list)
if (to >= 0 && to < array.length)
array.splice(to, 0, array.splice(from, 1)[0])
if (to >= 0 && to < array.length) {
const element = array.splice(from, 1)[0]
Promise.resolve().then(() => {
array.splice(to, 0, element)
})
}
}

0 comments on commit 04c147e

Please sign in to comment.