fix(runtime-core): set fragment root children should also update dynamicChildren (#944)
fix #943
This commit is contained in:
parent
bc78de2494
commit
a27e9ee9ae
@ -163,6 +163,7 @@ const getChildRoot = (
|
|||||||
return [vnode, undefined]
|
return [vnode, undefined]
|
||||||
}
|
}
|
||||||
const rawChildren = vnode.children as VNodeArrayChildren
|
const rawChildren = vnode.children as VNodeArrayChildren
|
||||||
|
const dynamicChildren = vnode.dynamicChildren as VNodeArrayChildren
|
||||||
const children = rawChildren.filter(child => {
|
const children = rawChildren.filter(child => {
|
||||||
return !(isVNode(child) && child.type === Comment)
|
return !(isVNode(child) && child.type === Comment)
|
||||||
})
|
})
|
||||||
@ -171,7 +172,13 @@ const getChildRoot = (
|
|||||||
}
|
}
|
||||||
const childRoot = children[0]
|
const childRoot = children[0]
|
||||||
const index = rawChildren.indexOf(childRoot)
|
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]
|
return [normalizeVNode(childRoot), setRoot]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user