chore: revert

This commit is contained in:
zhiyuanzmj 2025-04-26 22:04:53 +08:00
parent 172df6a2f1
commit 41ad10cbcd
1 changed files with 20 additions and 35 deletions

View File

@ -182,14 +182,6 @@ export function createComponent(
appContext, appContext,
) )
// HMR
if (__DEV__ && component.__hmrId) {
registerHMR(instance)
instance.isSingleRoot = isSingleRoot
instance.hmrRerender = hmrRerender.bind(null, instance)
instance.hmrReload = hmrReload.bind(null, instance)
}
if (__DEV__) { if (__DEV__) {
pushWarningContext(instance) pushWarningContext(instance)
startMeasure(instance, `init`) startMeasure(instance, `init`)
@ -229,6 +221,14 @@ export function createComponent(
// TODO make the proxy warn non-existent property access during dev // TODO make the proxy warn non-existent property access during dev
instance.setupState = proxyRefs(setupResult) instance.setupState = proxyRefs(setupResult)
devRender(instance) devRender(instance)
// HMR
if (component.__hmrId) {
registerHMR(instance)
instance.isSingleRoot = isSingleRoot
instance.hmrRerender = hmrRerender.bind(null, instance)
instance.hmrReload = hmrReload.bind(null, instance)
}
} }
} else { } else {
// component has a render function but no setup function // component has a render function but no setup function
@ -283,9 +283,8 @@ export let isApplyingFallthroughProps = false
*/ */
export function devRender(instance: VaporComponentInstance): void { export function devRender(instance: VaporComponentInstance): void {
instance.block = instance.block =
(instance.type.render callWithErrorHandling(
? callWithErrorHandling( instance.type.render!,
instance.type.render,
instance, instance,
ErrorCodes.RENDER_FUNCTION, ErrorCodes.RENDER_FUNCTION,
[ [
@ -295,21 +294,7 @@ export function devRender(instance: VaporComponentInstance): void {
instance.attrs, instance.attrs,
instance.slots, instance.slots,
], ],
) ) || []
: callWithErrorHandling(
isFunction(instance.type) ? instance.type : instance.type.setup!,
instance,
ErrorCodes.SETUP_FUNCTION,
[
instance.props,
{
slots: instance.slots,
attrs: instance.attrs,
emit: instance.emit,
expose: instance.expose,
},
],
)) || []
} }
const emptyContext: GenericAppContext = { const emptyContext: GenericAppContext = {