@@ -188,6 +188,14 @@ export function createComponent(
188
188
appContext ,
189
189
)
190
190
191
+ // HMR
192
+ if ( __DEV__ && component . __hmrId ) {
193
+ registerHMR ( instance )
194
+ instance . isSingleRoot = isSingleRoot
195
+ instance . hmrRerender = hmrRerender . bind ( null , instance )
196
+ instance . hmrReload = hmrReload . bind ( null , instance )
197
+ }
198
+
191
199
if ( __DEV__ ) {
192
200
pushWarningContext ( instance )
193
201
startMeasure ( instance , `init` )
@@ -227,14 +235,6 @@ export function createComponent(
227
235
// TODO make the proxy warn non-existent property access during dev
228
236
instance . setupState = proxyRefs ( setupResult )
229
237
devRender ( instance )
230
-
231
- // HMR
232
- if ( component . __hmrId ) {
233
- registerHMR ( instance )
234
- instance . isSingleRoot = isSingleRoot
235
- instance . hmrRerender = hmrRerender . bind ( null , instance )
236
- instance . hmrReload = hmrReload . bind ( null , instance )
237
- }
238
238
}
239
239
} else {
240
240
// component has a render function but no setup function
@@ -291,18 +291,33 @@ export let isApplyingFallthroughProps = false
291
291
*/
292
292
export function devRender ( instance : VaporComponentInstance ) : void {
293
293
instance . block =
294
- callWithErrorHandling (
295
- instance . type . render ! ,
296
- instance ,
297
- ErrorCodes . RENDER_FUNCTION ,
298
- [
299
- instance . setupState ,
300
- instance . props ,
301
- instance . emit ,
302
- instance . attrs ,
303
- instance . slots ,
304
- ] ,
305
- ) || [ ]
294
+ ( instance . type . render
295
+ ? callWithErrorHandling (
296
+ instance . type . render ,
297
+ instance ,
298
+ ErrorCodes . RENDER_FUNCTION ,
299
+ [
300
+ instance . setupState ,
301
+ instance . props ,
302
+ instance . emit ,
303
+ instance . attrs ,
304
+ instance . slots ,
305
+ ] ,
306
+ )
307
+ : callWithErrorHandling (
308
+ isFunction ( instance . type ) ? instance . type : instance . type . setup ! ,
309
+ instance ,
310
+ ErrorCodes . SETUP_FUNCTION ,
311
+ [
312
+ instance . props ,
313
+ {
314
+ slots : instance . slots ,
315
+ attrs : instance . attrs ,
316
+ emit : instance . emit ,
317
+ expose : instance . expose ,
318
+ } ,
319
+ ] ,
320
+ ) ) || [ ]
306
321
}
307
322
308
323
const emptyContext : GenericAppContext = {
0 commit comments