fix(core): use correct parent for v-if toggle

This commit is contained in:
Evan You 2019-12-01 23:42:14 -05:00
parent f5f2dca132
commit 24f6d63c6a

View File

@ -568,11 +568,13 @@ export function createRenderer<
patch( patch(
oldVNode, oldVNode,
newChildren[i], newChildren[i],
// in the case of a Fragment, we need to provide the actual parent // - 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, // of the Fragment itself so it can move its children.
// the parent container is not actually used so we just pass the // - In the case of a Comment, this is likely a v-if toggle, which also
// block element here to avoid a DOM parentNode call. // needs the correct parent container.
oldVNode.type === Fragment // 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!)! ? hostParentNode(oldVNode.el!)!
: fallbackContainer, : fallbackContainer,
null, null,