]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): condition for parent node check should be any different nodes
authorEvan You <yyx990803@gmail.com>
Thu, 16 Jan 2020 21:21:37 +0000 (16:21 -0500)
committerEvan You <yyx990803@gmail.com>
Thu, 16 Jan 2020 21:21:37 +0000 (16:21 -0500)
fix #622

packages/runtime-core/src/renderer.ts

index 99c0ac0867914b228e572a348caee485d3e36969..8d79dfb78670b7a8540d0683ff3521048edf03f9 100644 (file)
@@ -601,10 +601,9 @@ export function createRenderer<
         // - In the case of a Fragment, we need to provide the actual parent
         // of the Fragment itself so it can move its children.
         oldVNode.type === Fragment ||
-        // - In the case of Comment nodes, this is likely a v-if toggle, which
-        // also needs the correct parent container.
-        oldVNode.type === Comment ||
-        newVNode.type === Comment ||
+        // - In the case of different nodes, there is going to be a replacement
+        // which also requires the correct parent container
+        !isSameVNodeType(oldVNode, newVNode) ||
         // - In the case of a component, it could contain anything.
         oldVNode.shapeFlag & ShapeFlags.COMPONENT
           ? hostParentNode(oldVNode.el!)!
@@ -613,7 +612,7 @@ export function createRenderer<
             fallbackContainer
       patch(
         oldVNode,
-        newChildren[i],
+        newVNode,
         container,
         null,
         parentComponent,