From e1509e6a831cb51928241a08196afe4abc33341a Mon Sep 17 00:00:00 2001 From: johnsoncodehk Date: Thu, 5 Jan 2023 03:48:02 +0800 Subject: [PATCH] fix: don't incremental update for v-for expression close #2266 --- .../vue-language-core/src/plugins/vue-template-html.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vue-language-tools/vue-language-core/src/plugins/vue-template-html.ts b/vue-language-tools/vue-language-core/src/plugins/vue-template-html.ts index afb44e211..540322eb3 100644 --- a/vue-language-tools/vue-language-core/src/plugins/vue-template-html.ts +++ b/vue-language-tools/vue-language-core/src/plugins/vue-template-html.ts @@ -83,6 +83,9 @@ const plugin: VueLanguagePlugin = ({ modules }) => { if (node.arg && withinChangeRange(node.arg.loc) && node.name === 'slot') { return false; } + if (node.exp && withinChangeRange(node.exp.loc) && node.name === 'for') { // #2266 + return false; + } if (node.arg && !tryUpdateNode(node.arg)) { return false; } @@ -105,11 +108,11 @@ const plugin: VueLanguagePlugin = ({ modules }) => { } } else if (node.type === CompilerDOM.NodeTypes.IF) { - for (const branche of node.branches) { - if (branche.condition && !tryUpdateNode(branche.condition)) { + for (const branch of node.branches) { + if (branch.condition && !tryUpdateNode(branch.condition)) { return false; } - for (const child of branche.children) { + for (const child of branch.children) { if (!tryUpdateNode(child)) { return false; }