5
5
ComponentPublicInstance ,
6
6
runtimeCompiledRenderProxyHandlers
7
7
} from './componentProxy'
8
- import { ComponentPropsOptions } from './componentProps'
9
- import { Slots } from './componentSlots'
8
+ import { ComponentPropsOptions , resolveProps } from './componentProps'
9
+ import { Slots , resolveSlots } from './componentSlots'
10
10
import { warn } from './warning'
11
11
import {
12
12
ErrorCodes ,
@@ -34,6 +34,7 @@ import {
34
34
currentRenderingInstance ,
35
35
markAttrsAccessed
36
36
} from './componentRenderUtils'
37
+ import { ShapeFlags } from '.'
37
38
38
39
export type Data = { [ key : string ] : unknown }
39
40
@@ -268,10 +269,26 @@ export function validateComponentName(name: string, config: AppConfig) {
268
269
}
269
270
}
270
271
271
- export function setupStatefulComponent (
272
+ export function setupComponent (
272
273
instance : ComponentInternalInstance ,
273
274
parentSuspense : SuspenseBoundary | null
274
275
) {
276
+ const propsOptions = instance . type . props
277
+ const { props, children, shapeFlag } = instance . vnode
278
+ resolveProps ( instance , props , propsOptions )
279
+ resolveSlots ( instance , children )
280
+
281
+ // setup stateful logic
282
+ if ( shapeFlag & ShapeFlags . STATEFUL_COMPONENT ) {
283
+ return setupStatefulComponent ( instance , parentSuspense )
284
+ }
285
+ }
286
+
287
+ function setupStatefulComponent (
288
+ instance : ComponentInternalInstance ,
289
+ parentSuspense : SuspenseBoundary | null
290
+ ) {
291
+ let setupResult
275
292
const Component = instance . type as ComponentOptions
276
293
277
294
if ( __DEV__ ) {
@@ -307,7 +324,7 @@ export function setupStatefulComponent(
307
324
308
325
currentInstance = instance
309
326
currentSuspense = parentSuspense
310
- const setupResult = callWithErrorHandling (
327
+ setupResult = callWithErrorHandling (
311
328
setup ,
312
329
instance ,
313
330
ErrorCodes . SETUP_FUNCTION ,
@@ -333,6 +350,8 @@ export function setupStatefulComponent(
333
350
} else {
334
351
finishComponentSetup ( instance , parentSuspense )
335
352
}
353
+
354
+ return setupResult
336
355
}
337
356
338
357
export function handleSetupResult (
@@ -398,7 +417,7 @@ function finishComponentSetup(
398
417
`does not support runtime template compilation. Either use the ` +
399
418
`full build or pre-compile the template using Vue CLI.`
400
419
)
401
- } else {
420
+ } else if ( ! __SSR__ || ! Component . ssrRender ) {
402
421
warn (
403
422
`Component is missing${
404
423
__RUNTIME_COMPILE__ ? ` template or` : ``
0 commit comments