From 0a21145eb54b40488a1e6683986735c6aa98ec4e Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Thu, 27 Jun 2024 09:52:50 +0100 Subject: [PATCH] get the correct anchor node --- packages/svelte/src/internal/client/dom/blocks/each.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/svelte/src/internal/client/dom/blocks/each.js b/packages/svelte/src/internal/client/dom/blocks/each.js index 140fcd9008..45b0b0dd64 100644 --- a/packages/svelte/src/internal/client/dom/blocks/each.js +++ b/packages/svelte/src/internal/client/dom/blocks/each.js @@ -291,7 +291,10 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) { item = items.get(key); if (item === undefined) { - var child_anchor = current ? get_first_node(current.e) : anchor; + var effect_dom = current?.e.dom; + var child_anchor = /** @type {Node} */ ( + effect_dom ? (is_array(effect_dom) ? effect_dom[0] : effect_dom) : anchor + ); prev = create_item(child_anchor, prev, prev.next, value, key, i, render_fn, flags);