From: likui <2218301630@qq.com> Date: Wed, 8 Apr 2020 13:32:09 +0000 (+0800) Subject: fix(runtime-core): set fragment root children should also update dynamicChildren... X-Git-Tag: v3.0.0-alpha.12~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a27e9ee9aea3487ef3ef0c8a5df53227fc172886;p=thirdparty%2Fvuejs%2Fcore.git fix(runtime-core): set fragment root children should also update dynamicChildren (#944) fix #943 --- diff --git a/packages/runtime-core/src/componentRenderUtils.ts b/packages/runtime-core/src/componentRenderUtils.ts index 709ee85986..aec309446e 100644 --- a/packages/runtime-core/src/componentRenderUtils.ts +++ b/packages/runtime-core/src/componentRenderUtils.ts @@ -163,6 +163,7 @@ const getChildRoot = ( return [vnode, undefined] } const rawChildren = vnode.children as VNodeArrayChildren + const dynamicChildren = vnode.dynamicChildren as VNodeArrayChildren const children = rawChildren.filter(child => { return !(isVNode(child) && child.type === Comment) }) @@ -171,7 +172,13 @@ const getChildRoot = ( } const childRoot = children[0] const index = rawChildren.indexOf(childRoot) - const setRoot = (updatedRoot: VNode) => (rawChildren[index] = updatedRoot) + const dynamicIndex = dynamicChildren + ? dynamicChildren.indexOf(childRoot) + : null + const setRoot = (updatedRoot: VNode) => { + rawChildren[index] = updatedRoot + if (dynamicIndex !== null) dynamicChildren[dynamicIndex] = updatedRoot + } return [normalizeVNode(childRoot), setRoot] }