File tree 1 file changed +6
-13
lines changed
packages/server-renderer/src
1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,7 @@ import {
12
12
Portal ,
13
13
ShapeFlags ,
14
14
ssrUtils ,
15
- Slot ,
16
- createApp
15
+ Slot
17
16
} from 'vue'
18
17
import {
19
18
isString ,
@@ -84,22 +83,16 @@ function unrollBuffer(buffer: ResolvedSSRBuffer): string {
84
83
}
85
84
86
85
export async function renderToString ( input : App | VNode ) : Promise < string > {
87
- if ( isVNode ( input ) ) {
88
- return renderAppToString ( createApp ( { render : ( ) => input } ) )
89
- } else {
90
- return renderAppToString ( input )
91
- }
92
- }
93
-
94
- async function renderAppToString ( app : App ) : Promise < string > {
95
- const resolvedBuffer = await renderComponent ( app . _component , app . _props , null )
86
+ const resolvedBuffer = await ( isVNode ( input )
87
+ ? renderComponent ( { render : ( ) => input } )
88
+ : renderComponent ( input . _component , input . _props ) )
96
89
return unrollBuffer ( resolvedBuffer )
97
90
}
98
91
99
92
export function renderComponent (
100
93
comp : Component ,
101
- props : Props | null ,
102
- children : VNodeNormalizedChildren | null ,
94
+ props : Props | null = null ,
95
+ children : VNodeNormalizedChildren | null = null ,
103
96
parentComponent : ComponentInternalInstance | null = null
104
97
) : ResolvedSSRBuffer | Promise < ResolvedSSRBuffer > {
105
98
return renderComponentVNode (
You can’t perform that action at this time.
0 commit comments