Skip to content

Commit d946066

Browse files
authored
chore: yet another hydration tweak (#11763)
1 parent caab8da commit d946066

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -209,18 +209,17 @@ export function comment() {
209209
* Assign the created (or in hydration mode, traversed) dom elements to the current block
210210
* and insert the elements into the dom (in client mode).
211211
* @param {Text | Comment | Element} anchor
212-
* @param {DocumentFragment | Element | Comment} node
212+
* @param {DocumentFragment | Element} dom
213213
*/
214-
export function append(anchor, node) {
215-
if (!hydrating) {
216-
/** @type {import('#client').Dom} */
217-
const dom =
218-
node.nodeType === 11
219-
? /** @type {import('#client').TemplateNode[]} */ ([...node.childNodes])
220-
: /** @type {Element | Comment} */ (node);
214+
export function append(anchor, dom) {
215+
if (hydrating) return;
216+
217+
var effect = /** @type {import('#client').Effect} */ (current_effect);
221218

222-
/** @type {import('#client').Effect} */ (current_effect).dom = dom;
219+
effect.dom =
220+
dom.nodeType === 11
221+
? /** @type {import('#client').TemplateNode[]} */ ([...dom.childNodes])
222+
: /** @type {Element | Comment} */ (dom);
223223

224-
anchor.before(/** @type {Node} */ (node));
225-
}
224+
anchor.before(/** @type {Node} */ (dom));
226225
}

0 commit comments

Comments
 (0)