]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix: mounting new children
authorEvan You <yyx990803@gmail.com>
Sun, 22 Dec 2019 21:24:24 +0000 (16:24 -0500)
committerEvan You <yyx990803@gmail.com>
Sun, 22 Dec 2019 21:24:24 +0000 (16:24 -0500)
packages/runtime-core/src/renderer.ts
packages/runtime-core/src/vnode.ts

index 0b86923e860b2051bdb92541689875a81f6ddb25..69056ccd0b25fd15cca915c4cc59fc63738ae688 100644 (file)
@@ -1310,13 +1310,12 @@ export function createRenderer<
         const nextPos = e2 + 1
         const anchor =
           nextPos < l2 ? (c2[nextPos] as HostVNode).el : parentAnchor
-        const n2 = (c2[i] = optimized
-          ? cloneIfMounted(c2[i] as HostVNode)
-          : normalizeVNode(c2[i]))
         while (i <= e2) {
           patch(
             null,
-            n2,
+            (c2[i] = optimized
+              ? cloneIfMounted(c2[i] as HostVNode)
+              : normalizeVNode(c2[i])),
             container,
             anchor,
             parentComponent,
index 2d34e7c3b0232f60afe92af5eb2a9e0ab92fd179..cab6ce8a99451ae0ef0644dbdeaf48cf5619cfca 100644 (file)
@@ -355,7 +355,7 @@ export function normalizeVNode<T, U>(child: VNodeChild<T, U>): VNode<T, U> {
 
 // optimized normalization for template-compiled render fns
 export function cloneIfMounted(child: VNode): VNode {
-  return child.el == null ? child : cloneVNode(child)
+  return child.el === null ? child : cloneVNode(child)
 }
 
 export function normalizeChildren(vnode: VNode, children: unknown) {