Skip to content

Commit a1c063b

Browse files
committed
don't attempt to hydrate children of void dynamic element
1 parent 58dad20 commit a1c063b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/svelte/src/internal/client/dom/blocks/svelte-element.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export function element(anchor, get_tag, is_svg, render_fn) {
112112

113113
if (render_fn) {
114114
let anchor;
115+
115116
if (hydrating) {
116117
// Use the existing ssr comment as the anchor so that the inner open and close
117118
// methods can pick up the existing nodes correctly
@@ -120,7 +121,10 @@ export function element(anchor, get_tag, is_svg, render_fn) {
120121
anchor = empty();
121122
element.appendChild(anchor);
122123
}
123-
render_fn(element, anchor);
124+
125+
if (anchor) {
126+
render_fn(element, anchor);
127+
}
124128
}
125129

126130
anchor.before(element);

0 commit comments

Comments
 (0)