|
|
@@ -423,6 +423,7 @@ export interface SuspenseBoundary {
|
|
|
container: RendererElement
|
|
|
hiddenContainer: RendererElement
|
|
|
activeBranch: VNode | null
|
|
|
+ isFallbackMountPending: boolean
|
|
|
pendingBranch: VNode | null
|
|
|
deps: number
|
|
|
pendingId: number
|
|
|
@@ -508,6 +509,7 @@ function createSuspenseBoundary(
|
|
|
pendingId: suspenseId++,
|
|
|
timeout: typeof timeout === 'number' ? timeout : -1,
|
|
|
activeBranch: null,
|
|
|
+ isFallbackMountPending: false,
|
|
|
pendingBranch: null,
|
|
|
isInFallback: !isHydrating,
|
|
|
isHydrating,
|
|
|
@@ -565,7 +567,10 @@ function createSuspenseBoundary(
|
|
|
}
|
|
|
}
|
|
|
// unmount current active tree
|
|
|
- if (activeBranch) {
|
|
|
+ // #7966 when Suspense is wrapped in Transition, fallback may wait for
|
|
|
+ // afterLeave before mounting. In that window, activeBranch is still the
|
|
|
+ // leaving content, so avoid unmounting it again during resolve.
|
|
|
+ if (activeBranch && !suspense.isFallbackMountPending) {
|
|
|
// if the fallback tree was mounted, it may have been moved
|
|
|
// as part of a parent suspense. get the latest anchor for insertion
|
|
|
// #8105 if `delayEnter` is true, it means that the mounting of
|
|
|
@@ -591,6 +596,7 @@ function createSuspenseBoundary(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ suspense.isFallbackMountPending = false
|
|
|
setActiveBranch(suspense, pendingBranch!)
|
|
|
suspense.pendingBranch = null
|
|
|
suspense.isInFallback = false
|
|
|
@@ -646,6 +652,7 @@ function createSuspenseBoundary(
|
|
|
|
|
|
const anchor = next(activeBranch!)
|
|
|
const mountFallback = () => {
|
|
|
+ suspense.isFallbackMountPending = false
|
|
|
if (!suspense.isInFallback) {
|
|
|
return
|
|
|
}
|
|
|
@@ -667,6 +674,7 @@ function createSuspenseBoundary(
|
|
|
const delayEnter =
|
|
|
fallbackVNode.transition && fallbackVNode.transition.mode === 'out-in'
|
|
|
if (delayEnter) {
|
|
|
+ suspense.isFallbackMountPending = true
|
|
|
activeBranch!.transition!.afterLeave = mountFallback
|
|
|
}
|
|
|
suspense.isInFallback = true
|