@@ -182,6 +182,14 @@ export function createComponent(
182
182
appContext ,
183
183
)
184
184
185
+ // HMR
186
+ if ( __DEV__ && component . __hmrId ) {
187
+ registerHMR ( instance )
188
+ instance . isSingleRoot = isSingleRoot
189
+ instance . hmrRerender = hmrRerender . bind ( null , instance )
190
+ instance . hmrReload = hmrReload . bind ( null , instance )
191
+ }
192
+
185
193
if ( __DEV__ ) {
186
194
pushWarningContext ( instance )
187
195
startMeasure ( instance , `init` )
@@ -221,14 +229,6 @@ export function createComponent(
221
229
// TODO make the proxy warn non-existent property access during dev
222
230
instance . setupState = proxyRefs ( setupResult )
223
231
devRender ( instance )
224
-
225
- // HMR
226
- if ( component . __hmrId ) {
227
- registerHMR ( instance )
228
- instance . isSingleRoot = isSingleRoot
229
- instance . hmrRerender = hmrRerender . bind ( null , instance )
230
- instance . hmrReload = hmrReload . bind ( null , instance )
231
- }
232
232
}
233
233
} else {
234
234
// component has a render function but no setup function
@@ -283,18 +283,33 @@ export let isApplyingFallthroughProps = false
283
283
*/
284
284
export function devRender ( instance : VaporComponentInstance ) : void {
285
285
instance . block =
286
- callWithErrorHandling (
287
- instance . type . render ! ,
288
- instance ,
289
- ErrorCodes . RENDER_FUNCTION ,
290
- [
291
- instance . setupState ,
292
- instance . props ,
293
- instance . emit ,
294
- instance . attrs ,
295
- instance . slots ,
296
- ] ,
297
- ) || [ ]
286
+ ( instance . type . render
287
+ ? callWithErrorHandling (
288
+ instance . type . render ,
289
+ instance ,
290
+ ErrorCodes . RENDER_FUNCTION ,
291
+ [
292
+ instance . setupState ,
293
+ instance . props ,
294
+ instance . emit ,
295
+ instance . attrs ,
296
+ instance . slots ,
297
+ ] ,
298
+ )
299
+ : callWithErrorHandling (
300
+ isFunction ( instance . type ) ? instance . type : instance . type . setup ! ,
301
+ instance ,
302
+ ErrorCodes . SETUP_FUNCTION ,
303
+ [
304
+ instance . props ,
305
+ {
306
+ slots : instance . slots ,
307
+ attrs : instance . attrs ,
308
+ emit : instance . emit ,
309
+ expose : instance . expose ,
310
+ } ,
311
+ ] ,
312
+ ) ) || [ ]
298
313
}
299
314
300
315
const emptyContext : GenericAppContext = {
0 commit comments