pull/18320/head
Rich Harris 4 days ago
parent f184ceb6fe
commit 4faf2415eb

@ -33,10 +33,10 @@ function build_locations(nodes) {
/**
* @param {ComponentClientTransformState} state
* @param {string} name
* @param {Namespace} namespace
* @param {number} [flags]
*/
export function transform_template(state, name, namespace, flags = 0) {
export function transform_template(state, name, flags = 0) {
const namespace = state.metadata.namespace;
const tree = state.options.fragments === 'tree';
const expression = tree ? state.template.as_tree() : state.template.as_html();

@ -95,7 +95,7 @@ export function Fragment(node, context) {
let flags = state.template.needs_import_node ? TEMPLATE_USE_IMPORT_NODE : undefined;
const template_name = transform_template(state, 'root', namespace, flags);
const template_name = transform_template(state, 'root', flags);
state.init.unshift(b.var(id, b.call(template_name)));
close = b.stmt(b.call('$.append', b.id('$$anchor'), id));
@ -145,7 +145,7 @@ export function Fragment(node, context) {
// special case — we can use `$.comment` instead of creating a unique template
state.init.unshift(b.var(id, b.call('$.comment')));
} else {
const template_name = transform_template(state, 'root', namespace, flags);
const template_name = transform_template(state, 'root', flags);
state.init.unshift(b.var(id, b.call(template_name)));
}

@ -398,12 +398,7 @@ export function RegularElement(node, context) {
);
// Transform the template to $.from_html(...) and hoist it (deduplicating identical templates)
const template_name = transform_template(
select_state,
`${name}_content`,
metadata.namespace,
TEMPLATE_FRAGMENT
);
const template_name = transform_template(select_state, `${name}_content`, TEMPLATE_FRAGMENT);
// Build the rich content function body
// The anchor is the child of the element (a hydration marker during hydration)

Loading…
Cancel
Save