wip: more consistent compiler-sfc usage + inline mode for ssr
This commit is contained in:
@@ -223,6 +223,11 @@ export interface ComponentInternalInstance {
|
||||
* @internal
|
||||
*/
|
||||
render: InternalRenderFunction | null
|
||||
/**
|
||||
* SSR render function
|
||||
* @internal
|
||||
*/
|
||||
ssrRender?: Function | null
|
||||
/**
|
||||
* Object containing values this component provides for its descendents
|
||||
* @internal
|
||||
@@ -610,7 +615,13 @@ export function handleSetupResult(
|
||||
) {
|
||||
if (isFunction(setupResult)) {
|
||||
// setup returned an inline render function
|
||||
instance.render = setupResult as InternalRenderFunction
|
||||
if (!__BROWSER__ && (instance.type as ComponentOptions).__ssrInlineRender) {
|
||||
// when the function's name is `ssrRender` (compiled by SFC inline mode),
|
||||
// set it as ssrRender instead.
|
||||
instance.ssrRender = setupResult
|
||||
} else {
|
||||
instance.render = setupResult as InternalRenderFunction
|
||||
}
|
||||
} else if (isObject(setupResult)) {
|
||||
if (__DEV__ && isVNode(setupResult)) {
|
||||
warn(
|
||||
|
||||
@@ -121,7 +121,6 @@ export interface ComponentOptionsBase<
|
||||
/**
|
||||
* SSR only. This is produced by compiler-ssr and attached in compiler-sfc
|
||||
* not user facing, so the typing is lax and for test only.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
ssrRender?: (
|
||||
@@ -136,6 +135,13 @@ export interface ComponentOptionsBase<
|
||||
$options: ComponentInternalInstance['ctx']
|
||||
) => void
|
||||
|
||||
/**
|
||||
* Only generated by compiler-sfc to mark a ssr render function inlined and
|
||||
* returned from setup()
|
||||
* @internal
|
||||
*/
|
||||
__ssrInlineRender?: boolean
|
||||
|
||||
/**
|
||||
* marker for AsyncComponentWrapper
|
||||
* @internal
|
||||
|
||||
Reference in New Issue
Block a user