expect(serializeInner(root)).toBe('<div>async</div>')
viewRef.value = 1
- await nextTick() //TypeError: Cannot read properties of null (reading 'parentNode'),This has been fixed
+ await nextTick()
+ // TypeError: Cannot read properties of null (reading 'parentNode')
+ // This has been fixed
expect(serializeInner(root)).toBe(`<div>sync</div>`)
})
{ vnode, parent }: ComponentInternalInstance,
el: typeof vnode.el // HostNode
) {
- while (parent && parent.subTree === vnode) {
- ;(vnode = parent.vnode).el = el
- parent = parent.parent
+ while (parent) {
+ const root = parent.subTree
+ if (root.suspense && root.suspense.activeBranch === vnode) {
+ root.el = vnode.el
+ }
+ if (root === vnode) {
+ ;(vnode = parent.vnode).el = el
+ parent = parent.parent
+ } else {
+ break
+ }
}
}
if (!initialVNode.el) {
const placeholder = (instance.subTree = createVNode(Comment))
processCommentNode(null, placeholder, container!, anchor)
- // This noramlly gets setup by the following `setupRenderEffect`.
- // But the call is skipped in initial mounting of async element.
- // Thus, manually patching is required here or it will result in a crash during parent component update.
- initialVNode.el = placeholder.el
}
return
}