From 3146e6b942aa7b024184dfc466b4d85200c5bc32 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 7 Oct 2019 12:48:43 -0400 Subject: [PATCH] fix(compiler/v-if): avoid incorrect transform application on v-else/else-if branch children --- packages/compiler-core/src/transforms/vIf.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/compiler-core/src/transforms/vIf.ts b/packages/compiler-core/src/transforms/vIf.ts index b1182aa83..76df830dc 100644 --- a/packages/compiler-core/src/transforms/vIf.ts +++ b/packages/compiler-core/src/transforms/vIf.ts @@ -105,6 +105,9 @@ export const transformIf = createStructuralDirectiveTransform( // since the branch was removed, it will not be traversed. // make sure to traverse here. traverseChildren(branch, context) + // make sure to reset currentNode after traversal to indicate this + // node has been removed. + context.currentNode = null // attach this branch's codegen node to the v-if root. let parentCondition = sibling.codegenNode .expressions[1] as ConditionalExpression