We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1afcbc6 commit 9b9a268Copy full SHA for 9b9a268
packages/svelte/src/compiler/phases/2-analyze/index.js
@@ -797,9 +797,9 @@ const legacy_scope_tweaker = {
797
}
798
} else if (binding?.kind === 'each' && binding.mutated) {
799
// Ensure that the array is marked as reactive even when only its entries are mutated
800
- let idx = -1;
801
- let ancestor = path.at(idx);
802
- while (ancestor) {
+ let i = path.length;
+ while (i--) {
+ const ancestor = path[i];
803
if (
804
ancestor.type === 'EachBlock' &&
805
state.analysis.template.scopes.get(ancestor)?.declarations.get(node.name) === binding
@@ -811,7 +811,6 @@ const legacy_scope_tweaker = {
811
812
break;
813
814
- ancestor = path.at(--idx);
815
816
817
0 commit comments