sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
78.75k stars 4.13k forks source link

Keyed each block indexes out of order #13398

Open probablykasper opened 2 weeks ago

probablykasper commented 2 weeks ago

Describe the bug

A keyed {#each} block can get it's indexes incorrectly ordered if the variable is non-changing. The elements in the loop get rearranged, but without the indexes being updated.

Reproduction

https://svelte.dev/repl/83a6f6c444864e77a52aaefbb8e46a49?version=4.2.19

Logs

No response

System Info

System:
    OS: macOS 13.6.7
    CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
    Memory: 4.20 GB / 40.00 GB
    Shell: 3.6.1 - /usr/local/bin/fish
  Binaries:
    Node: 20.15.0 - ~/.local/share/mise/installs/node/20/bin/node
    npm: 10.7.0 - ~/.local/share/mise/installs/node/20/bin/npm
  Browsers:
    Brave Browser: 127.1.68.141
    Safari: 17.6
  npmPackages:
    svelte: ^4.2.19 => 4.2.19

Severity

annoyance

paoloricciuti commented 2 weeks ago

Looks like it's fixed by svelte 5