( vnode: VNode, parentComponent: ComponentInternalInstance | null = null, slotScopeId?: string, )
| 90 | } |
| 91 | |
| 92 | export function renderComponentVNode( |
| 93 | vnode: VNode, |
| 94 | parentComponent: ComponentInternalInstance | null = null, |
| 95 | slotScopeId?: string, |
| 96 | ): SSRBuffer | Promise<SSRBuffer> { |
| 97 | const instance = (vnode.component = createComponentInstance( |
| 98 | vnode, |
| 99 | parentComponent, |
| 100 | null, |
| 101 | )) |
| 102 | if (__DEV__) pushWarningContext(vnode) |
| 103 | const res = setupComponent(instance, true /* isSSR */) |
| 104 | if (__DEV__) popWarningContext() |
| 105 | const hasAsyncSetup = isPromise(res) |
| 106 | let prefetches = instance.sp /* LifecycleHooks.SERVER_PREFETCH */ |
| 107 | if (hasAsyncSetup || prefetches) { |
| 108 | const p: Promise<unknown> = Promise.resolve(res as Promise<void>) |
| 109 | .then(() => { |
| 110 | // instance.sp may be null until an async setup resolves, so evaluate it here |
| 111 | if (hasAsyncSetup) prefetches = instance.sp |
| 112 | if (prefetches) { |
| 113 | return Promise.all( |
| 114 | prefetches.map(prefetch => prefetch.call(instance.proxy)), |
| 115 | ) |
| 116 | } |
| 117 | }) |
| 118 | // Note: error display is already done by the wrapped lifecycle hook function. |
| 119 | .catch(NOOP) |
| 120 | return p.then(() => renderComponentSubTree(instance, slotScopeId)) |
| 121 | } else { |
| 122 | return renderComponentSubTree(instance, slotScopeId) |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | function renderComponentSubTree( |
| 127 | instance: ComponentInternalInstance, |
no test coverage detected