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 = {
23932393 const binding = /** @type {import('#compiler').Binding } */ ( context . state . scope . get ( item . name ) ) ;
23942394 binding . expression = ( id ) => {
23952395 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 ) ;
23972397 } ;
23982398 if ( node . index ) {
23992399 const index_binding = /** @type {import('#compiler').Binding } */ (
24002400 context . state . scope . get ( node . index )
24012401 ) ;
24022402 index_binding . expression = ( id ) => {
24032403 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 ) ;
24052405 } ;
24062406 }
24072407
Original file line number Diff line number Diff line change @@ -458,6 +458,10 @@ function reconcile_tracked_array(
458458 // are treated as reactive, so they get wrapped in a signal.
459459 if ( ( flags & EACH_IS_STRICT_EQUALS ) !== 0 && ! is_frozen ( array ) && ! ( STATE_SYMBOL in array ) ) {
460460 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+ }
461465 }
462466 var a_blocks = each_block . v ;
463467 const is_computed_key = keys !== null ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { flushSync } from 'svelte';
22import { test } from '../../test' ;
33
44export default test ( {
5- html : `1\n1\n<button>+</button>` ,
5+ html : `1\n1\n1\n1\ n<button>+</button>` ,
66
77 async test ( { assert, target } ) {
88 /**
@@ -16,6 +16,6 @@ export default test({
1616 btn1 . click ( ) ;
1717 } ) ;
1818
19- assert . htmlEqual ( target . innerHTML , `2\n2\n<button>+</button>` ) ;
19+ assert . htmlEqual ( target . innerHTML , `2\n2\n2\n2\ n<button>+</button>` ) ;
2020 }
2121} ) ;
Original file line number Diff line number Diff line change 1010 }
1111 </script >
1212
13+ {#each $store as item (item )}
14+ {item .value }
15+ {/each }
16+ {#each $storeDeeper .items as item (item )}
17+ {item .value }
18+ {/each }
1319{#each $store as item }
1420 {item .value }
1521{/each }
You can’t perform that action at this time.
0 commit comments