Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useSortable: order of dom and array is different #2924

Closed
7 tasks done
liuhbin opened this issue Apr 1, 2023 · 0 comments · Fixed by #2926
Closed
7 tasks done

useSortable: order of dom and array is different #2924

liuhbin opened this issue Apr 1, 2023 · 0 comments · Fixed by #2926

Comments

@liuhbin
Copy link

liuhbin commented Apr 1, 2023

Describe the bug

in the vueuse demo: https://vueuse.org/integrations/useSortable/

the problem can be reproduced by following these actions:
demo
result:
demo-result

temporary solution

<script setup lang="ts">
// ...
useSortable(el, list, {
  onUpdate: (e: { oldIndex: number; newIndex: number }) => {
    const item = list.splice(e.oldIndex, 1)[0]
    nextTick(() => list.splice(e.newIndex, 0, item))
  }
})
</script>

Reproduction

https://github.com/vueuse/vueuse/blob/main/packages/integrations/useSortable/demo.vue

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
    Memory: 6.28 GB / 15.94 GB
  Binaries:
    Node: 16.13.1 - D:\App\nodejs\node.EXE
    npm: 8.1.2 - D:\App\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (111.0.1661.62)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @vueuse/core: ^9.13.0 => 9.13.0
    @vueuse/head: ^1.1.19 => 1.1.19
    @vueuse/integrations: ^10.0.0-beta.2 => 10.0.0-beta.2
    vue: ^3.2.45 => 3.2.47

Used Package Manager

npm

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant