]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): set fragment root children should also update dynamicChildren...
authorlikui <2218301630@qq.com>
Wed, 8 Apr 2020 13:32:09 +0000 (21:32 +0800)
committerGitHub <noreply@github.com>
Wed, 8 Apr 2020 13:32:09 +0000 (09:32 -0400)
fix #943

packages/runtime-core/src/componentRenderUtils.ts

index 709ee85986cac865eef7f5092da737fc23633af5..aec309446ec58f96d72a8676032235aff969cd25 100644 (file)
@@ -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]
 }