-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
There is a problem with keyed each. #6444
Comments
Looks ok for me. When I use a key by value, I expect that the order of values in each will not change, when array reordered. But only new elements should be in the end of the list. UPD: think about it more, and yeah list should be in order of current element positions in array. |
incidentally, using the array index position as the key still works: https://svelte.dev/repl/a3f0f86ca2014efeb3db9ea3fbd5c21b?version=3.38.3 |
If the key is an index, the element has not actually changed, only the content has changed. |
I have slightly modified the original REPL here : https://svelte.dev/repl/78dfb2a56074467f8acc0fec7a6f70c0?version=3.38.3 This is a very serious issue. For example, I am showing a sorted table to user, and my sorted items are scrambled up like this. |
This should be fixed in 3.39.0 - https://svelte.dev/repl/9d71f9bdfec1443bb7d65064000861db?version=3.39.0 |
Maybe the same problem, I have the version 3.48 :
|
I'm having the same issue in 3.46 |
You need to create a new issue with minumum REPL. |
Describe the bug
There is a problem with keyed each.
When the position of the array is changed, the position of the element is strange.
To Reproduce
To help us help you, if you've found a bug please consider the following:
https://svelte.dev/repl/9d71f9bdfec1443bb7d65064000861db?version=3.38.3
Expected behavior
A clear and concise description of what you expected to happen.
When click button, change [1, 2, 3] to [2, 3 ,4, 1]
Severity
How severe an issue is this bug to you? Is this annoying, blocking some users, blocking an upgrade or blocking your usage of Svelte entirely?
If the position of the item changes but the element does not change, the problem is big.
The text was updated successfully, but these errors were encountered: