mirror of https://github.com/vuejs/core.git
fix(suspense): should discard unmount effects of invalidated pending branch
This commit is contained in:
parent
49bb44756f
commit
5bfcad155b
|
@ -380,8 +380,8 @@ describe('Suspense', () => {
|
||||||
await Promise.all(deps)
|
await Promise.all(deps)
|
||||||
await nextTick()
|
await nextTick()
|
||||||
expect(serializeInner(root)).toBe(`<!---->`)
|
expect(serializeInner(root)).toBe(`<!---->`)
|
||||||
// should discard effects (except for unmount)
|
// should discard effects
|
||||||
expect(calls).toEqual(['unmounted'])
|
expect(calls).toEqual([])
|
||||||
})
|
})
|
||||||
|
|
||||||
test('unmount suspense after resolve', async () => {
|
test('unmount suspense after resolve', async () => {
|
||||||
|
|
|
@ -201,11 +201,12 @@ function patchSuspense(
|
||||||
suspense.isHydrating = false
|
suspense.isHydrating = false
|
||||||
suspense.activeBranch = pendingBranch
|
suspense.activeBranch = pendingBranch
|
||||||
} else {
|
} else {
|
||||||
unmount(pendingBranch, parentComponent, null)
|
unmount(pendingBranch, parentComponent, suspense)
|
||||||
}
|
}
|
||||||
// increment pending ID. this is used to invalidate async callbacks
|
// increment pending ID. this is used to invalidate async callbacks
|
||||||
// reset suspense state
|
// reset suspense state
|
||||||
suspense.deps = 0
|
suspense.deps = 0
|
||||||
|
// discard effects from pending branch
|
||||||
suspense.effects.length = 0
|
suspense.effects.length = 0
|
||||||
// discard previous container
|
// discard previous container
|
||||||
suspense.hiddenContainer = createElement('div')
|
suspense.hiddenContainer = createElement('div')
|
||||||
|
|
Loading…
Reference in New Issue