diff --git a/packages/svelte/src/compiler/phases/3-transform/client/types.d.ts b/packages/svelte/src/compiler/phases/3-transform/client/types.d.ts index 01ad67d04d..fcb9d13d2b 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/types.d.ts +++ b/packages/svelte/src/compiler/phases/3-transform/client/types.d.ts @@ -33,8 +33,6 @@ export interface ComponentClientTransformState extends ClientTransformState { readonly init: Statement[]; /** Stuff that happens inside the render effect */ readonly update: { - /** If the update array only contains a single entry, this singular entry will be used, if present */ - singular?: Statement; /** Used if condition for singular prop is false (see comment above) */ grouped: Statement; }[]; diff --git a/packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js b/packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js index 6515fc9a16..5abf1c0a5a 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js @@ -106,7 +106,7 @@ function serialize_style_directives(style_directives, element_id, context, is_at if (!is_attributes_reactive && contains_call_expression) { state.init.push(singular); } else if (is_attributes_reactive || directive.metadata.dynamic || contains_call_expression) { - state.update.push({ grouped, singular }); + state.update.push({ grouped }); } else { state.init.push(grouped); } @@ -155,7 +155,7 @@ function serialize_class_directives(class_directives, element_id, context, is_at if (!is_attributes_reactive && contains_call_expression) { state.init.push(singular); } else if (is_attributes_reactive || directive.metadata.dynamic || contains_call_expression) { - state.update.push({ grouped, singular }); + state.update.push({ grouped }); } else { state.init.push(grouped); } @@ -334,7 +334,6 @@ function serialize_element_spread_attributes( } } else { context.state.update.push({ - singular: needs_select_handling ? undefined : standalone, grouped: inside_effect }); } @@ -414,7 +413,6 @@ function serialize_dynamic_element_attributes(attributes, context, element_id) { const id = context.state.scope.generate('spread_attributes'); context.state.init.push(b.let(id)); context.state.update.push({ - singular: isolated, grouped: b.stmt( b.assignment( '=', @@ -566,7 +564,7 @@ function serialize_element_attribute_update_assignment(element, node_id, attribu if (contains_call_expression && singular) { state.init.push(singular); } else { - state.update.push({ singular, grouped }); + state.update.push({ grouped }); } return true; } else { @@ -710,7 +708,6 @@ function serialize_update_assignment(state, id, init, value, assignment, contain if (assignment.skip_condition) { if (assignment.singular) { state.update.push({ - singular: assignment.singular, grouped: assignment.grouped }); } else { @@ -723,7 +720,6 @@ function serialize_update_assignment(state, id, init, value, assignment, contain if (assignment.singular) { state.init.push(b.var(id, init)); state.update.push({ - singular: assignment.singular, grouped }); } else { @@ -1279,10 +1275,6 @@ function get_template_function(namespace, state) { * @param {import('../types.js').ComponentClientTransformState} state */ function serialize_render_stmt(state) { - if (state.update.length === 1 && state.update[0].singular) { - return state.update[0].singular; - } - return b.stmt(b.call('$.render_effect', b.thunk(b.block(state.update.map((n) => n.grouped))))); } diff --git a/packages/svelte/tests/snapshot/samples/each-string-template/_expected/client/index.svelte.js b/packages/svelte/tests/snapshot/samples/each-string-template/_expected/client/index.svelte.js index 459e9d8313..2e7264e5b4 100644 --- a/packages/svelte/tests/snapshot/samples/each-string-template/_expected/client/index.svelte.js +++ b/packages/svelte/tests/snapshot/samples/each-string-template/_expected/client/index.svelte.js @@ -17,7 +17,10 @@ export default function Each_string_template($$anchor, $$props) { ($$anchor, thing, $$index) => { var text = $.space_frag($$anchor); - $.text_effect(text, () => `${$.stringify($.unwrap(thing))}, `); + $.render_effect(() => { + $.text(text, `${$.stringify($.unwrap(thing))}, `); + }); + return $.close($$anchor, text); }, null diff --git a/packages/svelte/tests/snapshot/samples/function-prop-no-getter/_expected/client/index.svelte.js b/packages/svelte/tests/snapshot/samples/function-prop-no-getter/_expected/client/index.svelte.js index ef889d5c4a..3a8d163fad 100644 --- a/packages/svelte/tests/snapshot/samples/function-prop-no-getter/_expected/client/index.svelte.js +++ b/packages/svelte/tests/snapshot/samples/function-prop-no-getter/_expected/client/index.svelte.js @@ -23,7 +23,10 @@ export default function Function_prop_no_getter($$anchor, $$props) { children: ($$anchor, $$slotProps) => { var text = $.space_frag($$anchor); - $.text_effect(text, () => `clicks: ${$.stringify($.get(count))}`); + $.render_effect(() => { + $.text(text, `clicks: ${$.stringify($.get(count))}`); + }); + return $.close($$anchor, text); } });