From 138569aa00d6fbf740b00caed38b61443d8afc5b Mon Sep 17 00:00:00 2001 From: Thorn Walli Date: Sat, 27 Apr 2024 17:29:31 +0200 Subject: [PATCH] fix(hydrate): fix missing negate --- src/runtime/hydrate.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/runtime/hydrate.js b/src/runtime/hydrate.js index 580ec7b630..f2c55592c8 100644 --- a/src/runtime/hydrate.js +++ b/src/runtime/hydrate.js @@ -3,18 +3,18 @@ import { hydrateWhenVisible } from 'vue3-lazy-hydration'; const isDev = process.env.NODE_ENV === 'development'; export default component => { - if (isDev || import.meta.server) { - if (typeof component === 'function') { - component = defineAsyncComponent(component); - } - return component; - } - const runtimeConfig = useRuntimeConfig(); - return hydrateWhenVisible(component, { + return hydrateWhenVisible(wrapComponent(component), { observerOptions: { rootMargin: runtimeConfig.public.booster.lazyOffsetComponent || '0%' } }); }; + +const wrapComponent = component => { + if (!(isDev || import.meta.server) && typeof component === 'function') { + return defineAsyncComponent(component); + } + return component; +};