(instance, setupRenderEffect, optimized)
| 711 | }, |
| 712 | |
| 713 | registerDep(instance, setupRenderEffect, optimized) { |
| 714 | const isInPendingSuspense = !!suspense.pendingBranch |
| 715 | if (isInPendingSuspense) { |
| 716 | suspense.deps++ |
| 717 | } |
| 718 | const hydratedEl = instance.vnode.el |
| 719 | instance |
| 720 | .asyncDep!.catch(err => { |
| 721 | handleError(err, instance, ErrorCodes.SETUP_FUNCTION) |
| 722 | }) |
| 723 | .then(asyncSetupResult => { |
| 724 | // retry when the setup() promise resolves. |
| 725 | // component may have been unmounted before resolve. |
| 726 | if ( |
| 727 | instance.isUnmounted || |
| 728 | suspense.isUnmounted || |
| 729 | suspense.pendingId !== instance.suspenseId |
| 730 | ) { |
| 731 | return |
| 732 | } |
| 733 | // withAsyncContext defers cleanup to a later microtask, so currentInstance may |
| 734 | // still be set when Suspense re-enters another component's render path. |
| 735 | // Clear it first. |
| 736 | unsetCurrentInstance() |
| 737 | // retry from this component |
| 738 | instance.asyncResolved = true |
| 739 | const { vnode } = instance |
| 740 | if (__DEV__) { |
| 741 | pushWarningContext(vnode) |
| 742 | } |
| 743 | handleSetupResult(instance, asyncSetupResult, false) |
| 744 | if (hydratedEl) { |
| 745 | // vnode may have been replaced if an update happened before the |
| 746 | // async dep is resolved. |
| 747 | vnode.el = hydratedEl |
| 748 | } |
| 749 | const placeholder = !hydratedEl && instance.subTree.el |
| 750 | setupRenderEffect( |
| 751 | instance, |
| 752 | vnode, |
| 753 | // component may have been moved before resolve. |
| 754 | // if this is not a hydration, instance.subTree will be the comment |
| 755 | // placeholder. |
| 756 | parentNode(hydratedEl || instance.subTree.el!)!, |
| 757 | // anchor will not be used if this is hydration, so only need to |
| 758 | // consider the comment placeholder case. |
| 759 | hydratedEl ? null : next(instance.subTree), |
| 760 | suspense, |
| 761 | namespace, |
| 762 | optimized, |
| 763 | ) |
| 764 | if (placeholder) { |
| 765 | // clean up placeholder reference |
| 766 | vnode.placeholder = null |
| 767 | remove(placeholder) |
| 768 | } |
| 769 | updateHOCHostEl(instance, vnode.el) |
| 770 | if (__DEV__) { |
nothing calls this directly
no test coverage detected