(
node: Node,
vnode: VNode,
parentComponent: ComponentInternalInstance | null,
parentSuspense: SuspenseBoundary | null,
namespace: ElementNamespace,
slotScopeIds: string[] | null,
optimized: boolean,
rendererInternals: RendererInternals,
hydrateNode: (
node: Node,
vnode: VNode,
parentComponent: ComponentInternalInstance | null,
parentSuspense: SuspenseBoundary | null,
slotScopeIds: string[] | null,
optimized: boolean,
) => Node | null,
)
| 802 | } |
| 803 | |
| 804 | function hydrateSuspense( |
| 805 | node: Node, |
| 806 | vnode: VNode, |
| 807 | parentComponent: ComponentInternalInstance | null, |
| 808 | parentSuspense: SuspenseBoundary | null, |
| 809 | namespace: ElementNamespace, |
| 810 | slotScopeIds: string[] | null, |
| 811 | optimized: boolean, |
| 812 | rendererInternals: RendererInternals, |
| 813 | hydrateNode: ( |
| 814 | node: Node, |
| 815 | vnode: VNode, |
| 816 | parentComponent: ComponentInternalInstance | null, |
| 817 | parentSuspense: SuspenseBoundary | null, |
| 818 | slotScopeIds: string[] | null, |
| 819 | optimized: boolean, |
| 820 | ) => Node | null, |
| 821 | ): Node | null { |
| 822 | const suspense = (vnode.suspense = createSuspenseBoundary( |
| 823 | vnode, |
| 824 | parentSuspense, |
| 825 | parentComponent, |
| 826 | node.parentNode!, |
| 827 | // eslint-disable-next-line no-restricted-globals |
| 828 | document.createElement('div'), |
| 829 | null, |
| 830 | namespace, |
| 831 | slotScopeIds, |
| 832 | optimized, |
| 833 | rendererInternals, |
| 834 | true /* hydrating */, |
| 835 | )) |
| 836 | // there are two possible scenarios for server-rendered suspense: |
| 837 | // - success: ssr content should be fully resolved |
| 838 | // - failure: ssr content should be the fallback branch. |
| 839 | // however, on the client we don't really know if it has failed or not |
| 840 | // attempt to hydrate the DOM assuming it has succeeded, but we still |
| 841 | // need to construct a suspense boundary first |
| 842 | const result = hydrateNode( |
| 843 | node, |
| 844 | (suspense.pendingBranch = vnode.ssContent!), |
| 845 | parentComponent, |
| 846 | suspense, |
| 847 | slotScopeIds, |
| 848 | optimized, |
| 849 | ) |
| 850 | if (suspense.deps === 0) { |
| 851 | suspense.resolve(false, true) |
| 852 | } |
| 853 | return result |
| 854 | } |
| 855 | |
| 856 | function normalizeSuspenseChildren(vnode: VNode): void { |
| 857 | const { shapeFlag, children } = vnode |
nothing calls this directly
no test coverage detected