Skip to content

Commit 45cc648

Browse files
committed
no need to use is_array, it is always an array when hydrating
1 parent 3199f50 commit 45cc648

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/svelte/src/internal/client/dom/template.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,11 @@ export function comment(anchor) {
179179
function close_template(dom, is_fragment, anchor) {
180180
/** @type {import('#client').Dom} */
181181
var current = is_fragment
182-
? is_array(dom)
183-
? dom
184-
: /** @type {import('#client').TemplateNode[]} */ (Array.from(dom.childNodes))
182+
? hydrating
183+
? // if hydrating, `dom` is already an array of nodes
184+
dom
185+
: // otherwise we need to create an array to store it on the current effect
186+
/** @type {import('#client').TemplateNode[]} */ (Array.from(dom.childNodes))
185187
: dom;
186188

187189
if (!hydrating && anchor !== null) {

0 commit comments

Comments
 (0)