File tree 2 files changed +13
-9
lines changed
packages/svelte/src/compiler/phases/3-transform/client/visitors
2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " svelte " : patch
3
+ ---
4
+
5
+ fix: makes keyed each blocks consistent between dev and prod
Original file line number Diff line number Diff line change @@ -2383,17 +2383,16 @@ export const template_visitors = {
2383
2383
/** @type {import('estree').BlockStatement } */ ( context . visit ( node . fallback ) )
2384
2384
)
2385
2385
: b . literal ( null ) ;
2386
- const key_function =
2387
- node . key && ( ( each_type & EACH_ITEM_REACTIVE ) !== 0 || context . state . options . dev )
2388
- ? b . arrow (
2389
- [ node . context . type === 'Identifier' ? node . context : b . id ( '$$item' ) , index ] ,
2390
- b . block (
2391
- declarations . concat (
2392
- b . return ( /** @type {import('estree').Expression } */ ( context . visit ( node . key ) ) )
2393
- )
2386
+ const key_function = node . key
2387
+ ? b . arrow (
2388
+ [ node . context . type === 'Identifier' ? node . context : b . id ( '$$item' ) , index ] ,
2389
+ b . block (
2390
+ declarations . concat (
2391
+ b . return ( /** @type {import('estree').Expression } */ ( context . visit ( node . key ) ) )
2394
2392
)
2395
2393
)
2396
- : b . literal ( null ) ;
2394
+ )
2395
+ : b . literal ( null ) ;
2397
2396
2398
2397
if ( node . index && each_node_meta . contains_group_binding ) {
2399
2398
// We needed to create a unique identifier for the index above, but we want to use the
You can’t perform that action at this time.
0 commit comments