From 24f6d63c6af16bc3a6e09452a3c4b9eb8264ad0c Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 1 Dec 2019 23:42:14 -0500 Subject: [PATCH] fix(core): use correct parent for v-if toggle --- packages/runtime-core/src/renderer.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/runtime-core/src/renderer.ts b/packages/runtime-core/src/renderer.ts index f666304b1..91de84c72 100644 --- a/packages/runtime-core/src/renderer.ts +++ b/packages/runtime-core/src/renderer.ts @@ -568,11 +568,13 @@ export function createRenderer< patch( oldVNode, newChildren[i], - // in the case of a Fragment, we need to provide the actual parent - // of the Fragment itself so it can move its children. In other cases, - // the parent container is not actually used so we just pass the - // block element here to avoid a DOM parentNode call. - oldVNode.type === Fragment + // - In the case of a Fragment, we need to provide the actual parent + // of the Fragment itself so it can move its children. + // - In the case of a Comment, this is likely a v-if toggle, which also + // needs the correct parent container. + // In other cases, the parent container is not actually used so we just + // pass the block element here to avoid a DOM parentNode call. + oldVNode.type === Fragment || oldVNode.type === Comment ? hostParentNode(oldVNode.el!)! : fallbackContainer, null,