fix: ensure keyed fallback to indexed (#9441)

Fixes #9408. Ensures that if we have a key that matches the index, that we fallback to using an indexed each block.
pull/9446/head
Dominic Gannaway 1 year ago committed by GitHub
parent da37c928ef
commit cf63220a0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,5 @@
---
'svelte': patch
---
patch: ensure keyed each block fallback to indexed each block

@ -2066,7 +2066,10 @@ export const template_visitors = {
/** @type {number} */
let each_type;
if (node.key) {
if (
node.key &&
(node.key.type !== 'Identifier' || !node.index || node.key.name !== node.index)
) {
each_type = EACH_KEYED;
if (
node.key.type === 'Identifier' &&

@ -0,0 +1,5 @@
import { test } from '../../test';
export default test({
html: '1'
});
Loading…
Cancel
Save