File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
packages/svelte/src/compiler/phases/3-transform/client/visitors/shared Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -69,14 +69,17 @@ export function build_template_chunk(
6969 node . metadata . expression
7070 ) ;
7171
72+ const evaluated = state . scope . evaluate ( value ) ;
73+
74+ has_state ||= node . metadata . expression . has_state && ! evaluated . is_known ;
75+
7276 if ( values . length === 1 ) {
7377 // If we have a single expression, then pass that in directly to possibly avoid doing
7478 // extra work in the template_effect (instead we do the work in set_text).
75- const evaluated = state . scope . evaluate ( value ) ;
76- has_state ||= node . metadata . expression . has_state && ! evaluated . is_known ;
7779 if ( evaluated . is_known ) {
7880 value = b . literal ( evaluated . value ) ;
7981 }
82+
8083 return { value, has_state } ;
8184 }
8285
@@ -92,10 +95,6 @@ export function build_template_chunk(
9295 }
9396 }
9497
95- const evaluated = state . scope . evaluate ( value ) ;
96-
97- has_state ||= node . metadata . expression . has_state && ! evaluated . is_known ;
98-
9998 if ( evaluated . is_known ) {
10099 quasi . value . cooked += evaluated . value + '' ;
101100 } else {
You can’t perform that action at this time.
0 commit comments