-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Describe the bug
Using animate:flip in an #each and completely reordering the list causes duplicated items and a broken animation (elements leaving the bounds of the list and such).
When moving one item to the other end of the list at a time, the animation disappears after having moved all of them. Also, only one item is animated even though all items have to move and thus should be animated.
Not sure how this relates to #9655, which also uses transitions. If this is just a special case, feel free to close this as duplicate.
Reproduction
Tried a more simple example where one item gets moved from start of list to the end:
<script>
import { flip } from 'svelte/animate';
let items = Array.from({ length: 5 }, (_, i) => ({ id: i, text: `Item ${i+1}` }))
function update() {
const [first, ...rest] = items;
items = [...rest, first];
}
</script>
<button on:click={update}>Shift</button>
<div class="list">
{#each items as item (item.id)}
<div animate:flip>{item.text}</div>
{/each}
</div>Here the animation disappears after cycling through the list once.
Logs
No response
System Info
REPL - Svelte v5.0.0-next.19Severity
annoyance
mquandalle
Metadata
Metadata
Assignees
Labels
No labels