Skip to content

Commit a27e9ee

Browse files
authored
fix(runtime-core): set fragment root children should also update dynamicChildren (#944)
fix #943
1 parent bc78de2 commit a27e9ee

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/runtime-core/src/componentRenderUtils.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ const getChildRoot = (
163163
return [vnode, undefined]
164164
}
165165
const rawChildren = vnode.children as VNodeArrayChildren
166+
const dynamicChildren = vnode.dynamicChildren as VNodeArrayChildren
166167
const children = rawChildren.filter(child => {
167168
return !(isVNode(child) && child.type === Comment)
168169
})
@@ -171,7 +172,13 @@ const getChildRoot = (
171172
}
172173
const childRoot = children[0]
173174
const index = rawChildren.indexOf(childRoot)
174-
const setRoot = (updatedRoot: VNode) => (rawChildren[index] = updatedRoot)
175+
const dynamicIndex = dynamicChildren
176+
? dynamicChildren.indexOf(childRoot)
177+
: null
178+
const setRoot = (updatedRoot: VNode) => {
179+
rawChildren[index] = updatedRoot
180+
if (dynamicIndex !== null) dynamicChildren[dynamicIndex] = updatedRoot
181+
}
175182
return [normalizeVNode(childRoot), setRoot]
176183
}
177184

0 commit comments

Comments
 (0)