pull/12335/head
Rich Harris 2 years ago
parent e7c8d61cdd
commit 9192bbba1e

@ -1,4 +1,4 @@
/** @import { Effect, TemplateNode } from '#client' */ /** @import { Effect, EffectNodes, TemplateNode } from '#client' */
import { namespace_svg } from '../../../../constants.js'; import { namespace_svg } from '../../../../constants.js';
import { import {
hydrate_next, hydrate_next,
@ -20,6 +20,7 @@ import { current_each_item, set_current_each_item } from './each.js';
import { current_component_context, current_effect } from '../../runtime.js'; import { current_component_context, current_effect } from '../../runtime.js';
import { DEV } from 'esm-env'; import { DEV } from 'esm-env';
import { EFFECT_TRANSPARENT } from '../../constants.js'; import { EFFECT_TRANSPARENT } from '../../constants.js';
import { assign_nodes } from '../template.js';
/** /**
* @param {Comment | Element} node * @param {Comment | Element} node
@ -116,6 +117,8 @@ export function element(node, get_tag, is_svg, render_fn, get_namespace, locatio
}; };
} }
assign_nodes(element, element);
if (render_fn) { if (render_fn) {
// If hydrating, use the existing ssr comment as the anchor so that the // If hydrating, use the existing ssr comment as the anchor so that the
// inner open and close methods can pick up the existing nodes correctly // inner open and close methods can pick up the existing nodes correctly
@ -138,8 +141,8 @@ export function element(node, get_tag, is_svg, render_fn, get_namespace, locatio
render_fn(element, child_anchor); render_fn(element, child_anchor);
} }
// we do this after calling `render_fn` so that child effects don't override `nodes` // we do this after calling `render_fn` so that child effects don't override `nodes.end`
/** @type {Effect} */ (current_effect).nodes = { start: element, end: element }; /** @type {Effect & { nodes: EffectNodes }} */ (current_effect).nodes.end = element;
anchor.before(element); anchor.before(element);
}); });

Loading…
Cancel
Save