wip(ssr): reduce reactivity overhead during ssr
This commit is contained in:
@@ -65,7 +65,8 @@ export function injectHook(
|
||||
export const createHook = <T extends Function = () => any>(
|
||||
lifecycle: LifecycleHooks
|
||||
) => (hook: T, target: ComponentInternalInstance | null = currentInstance) =>
|
||||
injectHook(lifecycle, hook, target)
|
||||
// post-create lifecycle registrations are noops during SSR
|
||||
!__SSR__ && injectHook(lifecycle, hook, target)
|
||||
|
||||
export const onBeforeMount = createHook(LifecycleHooks.BEFORE_MOUNT)
|
||||
export const onMounted = createHook(LifecycleHooks.MOUNTED)
|
||||
@@ -87,6 +88,10 @@ export type ErrorCapturedHook = (
|
||||
instance: ComponentPublicInstance | null,
|
||||
info: string
|
||||
) => boolean | void
|
||||
export const onErrorCaptured = createHook<ErrorCapturedHook>(
|
||||
LifecycleHooks.ERROR_CAPTURED
|
||||
)
|
||||
|
||||
export const onErrorCaptured = (
|
||||
hook: ErrorCapturedHook,
|
||||
target: ComponentInternalInstance | null = currentInstance
|
||||
) => {
|
||||
injectHook(LifecycleHooks.ERROR_CAPTURED, hook, target)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user