From: Evan You Date: Sun, 22 Dec 2019 21:24:24 +0000 (-0500) Subject: fix: mounting new children X-Git-Tag: v3.0.0-alpha.1~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7d436ab59a30562a049e199ae579df7ac8066829;p=thirdparty%2Fvuejs%2Fcore.git fix: mounting new children --- diff --git a/packages/runtime-core/src/renderer.ts b/packages/runtime-core/src/renderer.ts index 0b86923e86..69056ccd0b 100644 --- a/packages/runtime-core/src/renderer.ts +++ b/packages/runtime-core/src/renderer.ts @@ -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, diff --git a/packages/runtime-core/src/vnode.ts b/packages/runtime-core/src/vnode.ts index 2d34e7c3b0..cab6ce8a99 100644 --- a/packages/runtime-core/src/vnode.ts +++ b/packages/runtime-core/src/vnode.ts @@ -355,7 +355,7 @@ export function normalizeVNode(child: VNodeChild): VNode { // 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) {