File tree Expand file tree Collapse file tree 4 files changed +14
-4
lines changed
compiler/phases/3-transform/client/visitors
internal/client/dom/blocks
tests/runtime-runes/samples/each-updates-5 Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -2393,15 +2393,15 @@ export const template_visitors = {
2393
2393
const binding = /** @type {import('#compiler').Binding } */ ( context . state . scope . get ( item . name ) ) ;
2394
2394
binding . expression = ( id ) => {
2395
2395
const item_with_loc = with_loc ( item , id ) ;
2396
- return each_item_is_reactive ? b . call ( '$.unwrap' , item_with_loc ) : item_with_loc ;
2396
+ return b . call ( '$.unwrap' , item_with_loc ) ;
2397
2397
} ;
2398
2398
if ( node . index ) {
2399
2399
const index_binding = /** @type {import('#compiler').Binding } */ (
2400
2400
context . state . scope . get ( node . index )
2401
2401
) ;
2402
2402
index_binding . expression = ( id ) => {
2403
2403
const index_with_loc = with_loc ( index , id ) ;
2404
- return each_item_is_reactive ? b . call ( '$.unwrap' , index_with_loc ) : index_with_loc ;
2404
+ return b . call ( '$.unwrap' , index_with_loc ) ;
2405
2405
} ;
2406
2406
}
2407
2407
Original file line number Diff line number Diff line change @@ -458,6 +458,10 @@ function reconcile_tracked_array(
458
458
// are treated as reactive, so they get wrapped in a signal.
459
459
if ( ( flags & EACH_IS_STRICT_EQUALS ) !== 0 && ! is_frozen ( array ) && ! ( STATE_SYMBOL in array ) ) {
460
460
flags ^= EACH_IS_STRICT_EQUALS ;
461
+ // Additionally as we're in an keyed each block, we'll need ensure the itens are all wrapped in signals.
462
+ if ( ( flags & EACH_ITEM_REACTIVE ) === 0 ) {
463
+ flags ^= EACH_ITEM_REACTIVE ;
464
+ }
461
465
}
462
466
var a_blocks = each_block . v ;
463
467
const is_computed_key = keys !== null ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { flushSync } from 'svelte';
2
2
import { test } from '../../test' ;
3
3
4
4
export default test ( {
5
- html : `1\n1\n<button>+</button>` ,
5
+ html : `1\n1\n1\n1\ n<button>+</button>` ,
6
6
7
7
async test ( { assert, target } ) {
8
8
/**
@@ -16,6 +16,6 @@ export default test({
16
16
btn1 . click ( ) ;
17
17
} ) ;
18
18
19
- assert . htmlEqual ( target . innerHTML , `2\n2\n<button>+</button>` ) ;
19
+ assert . htmlEqual ( target . innerHTML , `2\n2\n2\n2\ n<button>+</button>` ) ;
20
20
}
21
21
} ) ;
Original file line number Diff line number Diff line change 10
10
}
11
11
</script >
12
12
13
+ {#each $store as item (item )}
14
+ {item .value }
15
+ {/each }
16
+ {#each $storeDeeper .items as item (item )}
17
+ {item .value }
18
+ {/each }
13
19
{#each $store as item }
14
20
{item .value }
15
21
{/each }
You can’t perform that action at this time.
0 commit comments