@@ -39,31 +39,31 @@ export function EachBlock(node, context) {
3939 if ( node . key ) context . visit ( node . key ) ;
4040 if ( node . fallback ) context . visit ( node . fallback ) ;
4141
42- let mutated = false ;
42+ if ( ! context . state . analysis . runes ) {
43+ let mutated =
44+ ! ! node . context &&
45+ extract_identifiers ( node . context ) . some ( ( id ) => {
46+ const binding = context . state . scope . get ( id . name ) ;
47+ return ! ! binding ?. mutated ;
48+ } ) ;
4349
44- // collect transitive dependencies...
45- for ( const binding of node . metadata . expression . dependencies ) {
46- collect_transitive_dependencies ( binding , node . metadata . transitive_deps ) ;
47- }
48-
49- if ( node . context ) {
50- for ( const id of extract_identifiers ( node . context ) ) {
51- const binding = context . state . scope . get ( id . name ) ;
52- if ( binding ?. mutated ) mutated = true ;
50+ // collect transitive dependencies...
51+ for ( const binding of node . metadata . expression . dependencies ) {
52+ collect_transitive_dependencies ( binding , node . metadata . transitive_deps ) ;
5353 }
54- }
5554
56- // ...and ensure they are marked as state, so they can be turned
57- // into mutable sources and invalidated
58- if ( mutated ) {
59- for ( const binding of node . metadata . transitive_deps ) {
60- if (
61- binding . kind === 'normal' &&
62- ( binding . declaration_kind === 'const' ||
63- binding . declaration_kind === 'let' ||
64- binding . declaration_kind === 'var' )
65- ) {
66- binding . kind = 'state' ;
55+ // ...and ensure they are marked as state, so they can be turned
56+ // into mutable sources and invalidated
57+ if ( mutated ) {
58+ for ( const binding of node . metadata . transitive_deps ) {
59+ if (
60+ binding . kind === 'normal' &&
61+ ( binding . declaration_kind === 'const' ||
62+ binding . declaration_kind === 'let' ||
63+ binding . declaration_kind === 'var' )
64+ ) {
65+ binding . kind = 'state' ;
66+ }
6767 }
6868 }
6969 }
0 commit comments