@@ -2409,10 +2409,7 @@ export const template_visitors = {
24092409
24102410 let flags = 0 ;
24112411
2412- if (
2413- node . key &&
2414- ( node . key . type !== 'Identifier' || ! node . index || node . key . name !== node . index )
2415- ) {
2412+ if ( node . metadata . keyed ) {
24162413 flags |= EACH_KEYED ;
24172414
24182415 if ( node . index ) {
@@ -2421,7 +2418,7 @@ export const template_visitors = {
24212418
24222419 // In runes mode, if key === item, we don't need to wrap the item in a source
24232420 const key_is_item =
2424- node . key . type === 'Identifier' &&
2421+ /** @type { Expression } */ ( node . key ) . type === 'Identifier' &&
24252422 node . context . type === 'Identifier' &&
24262423 node . context . name === node . key . name ;
24272424
@@ -2614,8 +2611,11 @@ export const template_visitors = {
26142611 /** @type {Expression } */
26152612 let key_function = b . id ( '$.index' ) ;
26162613
2617- if ( node . key ) {
2618- const expression = /** @type {Expression } */ ( context . visit ( node . key , key_state ) ) ;
2614+ if ( node . metadata . keyed ) {
2615+ const expression = /** @type {Expression } */ (
2616+ context . visit ( /** @type {Expression } */ ( node . key ) , key_state )
2617+ ) ;
2618+
26192619 key_function = b . arrow ( [ node . context , index ] , expression ) ;
26202620 }
26212621
@@ -3049,11 +3049,12 @@ export const template_visitors = {
30493049 call_expr = b . call ( `$.bind_focused` , state . node , setter ) ;
30503050 break ;
30513051 case 'group' : {
3052- /** @type {CallExpression[] } */
3053- const indexes = [ ] ;
3054- for ( const parent_each_block of node . metadata . parent_each_blocks ) {
3055- indexes . push ( b . call ( '$.unwrap' , parent_each_block . metadata . index ) ) ;
3056- }
3052+ const indexes = node . metadata . parent_each_blocks . map ( ( each ) => {
3053+ // if we have a keyed block with an index, the index is wrapped in a source
3054+ return each . metadata . keyed && each . index
3055+ ? b . call ( '$.get' , each . metadata . index )
3056+ : each . metadata . index ;
3057+ } ) ;
30573058
30583059 // We need to additionally invoke the value attribute signal to register it as a dependency,
30593060 // so that when the value is updated, the group binding is updated
0 commit comments