diff --git a/.changeset/silent-rabbits-join.md b/.changeset/silent-rabbits-join.md new file mode 100644 index 0000000000..82f157d9df --- /dev/null +++ b/.changeset/silent-rabbits-join.md @@ -0,0 +1,5 @@ +--- +"svelte": patch +--- + +fix: ensure we clear down each block opening anchors from document diff --git a/packages/svelte/src/internal/client/dom/blocks/each.js b/packages/svelte/src/internal/client/dom/blocks/each.js index b0c87d6e58..9867ed008a 100644 --- a/packages/svelte/src/internal/client/dom/blocks/each.js +++ b/packages/svelte/src/internal/client/dom/blocks/each.js @@ -280,7 +280,7 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) { item = items.get(key); if (item === undefined) { - var child_open = push_template_node(empty()); + var child_open = empty(); var child_anchor = current ? current.o : anchor; child_anchor.before(child_open); @@ -407,6 +407,7 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) { for (var i = 0; i < to_destroy.length; i += 1) { var item = to_destroy[i]; items.delete(item.k); + remove(item.o); link(item.prev, item.next); } });