MCPcopy
hub / github.com/vuejs/core / renderComponentVNode

Function renderComponentVNode

packages/server-renderer/src/render.ts:92–124  ·  view source on GitHub ↗
(
  vnode: VNode,
  parentComponent: ComponentInternalInstance | null = null,
  slotScopeId?: string,
)

Source from the content-addressed store, hash-verified

90}
91
92export 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
126function renderComponentSubTree(
127 instance: ComponentInternalInstance,

Callers 4

renderToSimpleStreamFunction · 0.90
renderToStringFunction · 0.90
ssrRenderComponentFunction · 0.90
renderVNodeFunction · 0.85

Calls 8

isPromiseFunction · 0.90
createComponentInstanceFunction · 0.85
pushWarningContextFunction · 0.85
setupComponentFunction · 0.85
popWarningContextFunction · 0.85
renderComponentSubTreeFunction · 0.85
mapMethod · 0.80
resolveMethod · 0.65

Tested by

no test coverage detected