mirror of https://github.com/vuejs/core.git
fix(Suspense): properly fix #6416
previous fix caused regressions in nuxt
This commit is contained in:
parent
33159a5916
commit
0db336ff6c
|
|
@ -1684,7 +1684,9 @@ describe('Suspense', () => {
|
|||
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>`)
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -428,8 +428,16 @@ export function updateHOCHostEl(
|
|||
{ 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1241,10 +1241,6 @@ function baseCreateRenderer(
|
|||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue