| 521 | effects: [], |
| 522 | |
| 523 | resolve(resume = false, sync = false) { |
| 524 | if (__DEV__) { |
| 525 | if (!resume && !suspense.pendingBranch) { |
| 526 | throw new Error( |
| 527 | `suspense.resolve() is called without a pending branch.`, |
| 528 | ) |
| 529 | } |
| 530 | if (suspense.isUnmounted) { |
| 531 | throw new Error( |
| 532 | `suspense.resolve() is called on an already unmounted suspense boundary.`, |
| 533 | ) |
| 534 | } |
| 535 | } |
| 536 | const { |
| 537 | vnode, |
| 538 | activeBranch, |
| 539 | pendingBranch, |
| 540 | pendingId, |
| 541 | effects, |
| 542 | parentComponent, |
| 543 | container, |
| 544 | isInFallback, |
| 545 | } = suspense |
| 546 | |
| 547 | // if there's a transition happening we need to wait it to finish. |
| 548 | let delayEnter: boolean | null = false |
| 549 | if (suspense.isHydrating) { |
| 550 | suspense.isHydrating = false |
| 551 | } else if (!resume) { |
| 552 | delayEnter = |
| 553 | activeBranch && |
| 554 | pendingBranch!.transition && |
| 555 | pendingBranch!.transition.mode === 'out-in' |
| 556 | let hasUpdatedAnchor = false |
| 557 | if (delayEnter) { |
| 558 | activeBranch!.transition!.afterLeave = () => { |
| 559 | if (pendingId === suspense.pendingId) { |
| 560 | move( |
| 561 | pendingBranch!, |
| 562 | container, |
| 563 | anchor === initialAnchor && !hasUpdatedAnchor |
| 564 | ? next(activeBranch!) |
| 565 | : anchor, |
| 566 | MoveType.ENTER, |
| 567 | ) |
| 568 | queuePostFlushCb(effects) |
| 569 | // clear el reference from fallback vnode to allow GC after transition |
| 570 | if (isInFallback && vnode.ssFallback) { |
| 571 | vnode.ssFallback.el = null |
| 572 | } |
| 573 | } |
| 574 | } |
| 575 | } |
| 576 | // unmount current active tree |
| 577 | // #7966 when Suspense is wrapped in Transition, fallback may wait for |
| 578 | // afterLeave before mounting. In that window, activeBranch is still the |
| 579 | // leaving content, so avoid unmounting it again during resolve. |
| 580 | if (activeBranch && !suspense.isFallbackMountPending) { |