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 fcb9d13d2b..8b4a00c4c5 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 @@ -32,10 +32,7 @@ export interface ComponentClientTransformState extends ClientTransformState { /** Stuff that happens before the render effect(s) */ readonly init: Statement[]; /** Stuff that happens inside the render effect */ - readonly update: { - /** Used if condition for singular prop is false (see comment above) */ - grouped: Statement; - }[]; + readonly update: Statement[]; /** Stuff that happens after the render effect (control blocks, dynamic elements, bindings, actions, etc) */ readonly after_update: Statement[]; /** The HTML template string */ 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 5abf1c0a5a..e8341eb101 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 }); + 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 }); + state.update.push(grouped); } else { state.init.push(grouped); } @@ -333,17 +333,15 @@ function serialize_element_spread_attributes( context.state.init.push(standalone); } } else { - context.state.update.push({ - grouped: inside_effect - }); + context.state.update.push(inside_effect); } if (needs_select_handling) { context.state.init.push( b.stmt(b.call('$.init_select', element_id, b.thunk(b.member(b.id(id), b.id('value'))))) ); - context.state.update.push({ - grouped: b.if( + context.state.update.push( + b.if( b.binary('in', b.literal('value'), b.id(id)), b.block([ // This ensures a one-way street to the DOM in case it's