diff --git a/packages/svelte/src/internal/client/dom/blocks/each.js b/packages/svelte/src/internal/client/dom/blocks/each.js index f00ef1b48c..c41b247844 100644 --- a/packages/svelte/src/internal/client/dom/blocks/each.js +++ b/packages/svelte/src/internal/client/dom/blocks/each.js @@ -77,13 +77,18 @@ function pause_effects(items, controlled_anchor, items_map) { ); clear_text_content(parent_node); parent_node.append(/** @type {Element} */ (controlled_anchor)); + items_map.clear(); + link(items[0].prev, items[length - 1].next); } run_out_transitions(transitions, () => { for (var i = 0; i < length; i++) { var item = items[i]; - items_map.delete(item.k); - link(item.prev, item.next); + if (!is_controlled) { + items_map.delete(item.k); + item.o.remove(); + link(item.prev, item.next); + } destroy_effect(item.e, !is_controlled); } });