From 0f79d798e90223f90e00686ac33c542de0a900a8 Mon Sep 17 00:00:00 2001 From: Michael Brevard Date: Tue, 18 Jun 2024 12:45:23 +0300 Subject: [PATCH] perf: avoid wrapping client vnode in dynamic vnode --- .../nuxt/src/components/runtime/client-delayed-component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nuxt/src/components/runtime/client-delayed-component.ts b/packages/nuxt/src/components/runtime/client-delayed-component.ts index eeca9d959c..a72cc82283 100644 --- a/packages/nuxt/src/components/runtime/client-delayed-component.ts +++ b/packages/nuxt/src/components/runtime/client-delayed-component.ts @@ -51,7 +51,7 @@ export const createLazyIOComponent = (componentLoader: Component) => { }) return () => { return h('div', { ref: el }, [ - isIntersecting.value ? h(componentLoader, attrs) : (instance.vnode.el && nuxt.isHydrating) ? createVNode(createStaticVNode(getFragmentHTML(instance.vnode.el ?? null, true)?.join('') || '', 1)) : null, + isIntersecting.value ? h(componentLoader, attrs) : (instance.vnode.el && nuxt.isHydrating) ? createStaticVNode(getFragmentHTML(instance.vnode.el ?? null, true)?.join('') || '', 1) : null, ]) } }, @@ -85,7 +85,7 @@ export const createLazyNetworkComponent = (componentLoader: Component) => { idleHandle = null } }) - return () => isIdle.value ? h(componentLoader, attrs) : (instance.vnode.el && nuxt.isHydrating) ? createVNode(createStaticVNode(getFragmentHTML(instance.vnode.el ?? null, true)?.join('') || '', 1)) : null + return () => isIdle.value ? h(componentLoader, attrs) : (instance.vnode.el && nuxt.isHydrating) ? createStaticVNode(getFragmentHTML(instance.vnode.el ?? null, true)?.join('') || '', 1) : null }, }) } @@ -123,7 +123,7 @@ export const createLazyEventComponent = (componentLoader: Component) => { registeredEvents?.forEach(remove => remove()) eventsMapper.delete(instance) }) - return () => isTriggered.value ? h(componentLoader, attrs) : (instance.vnode.el && nuxt.isHydrating) ? createVNode(createStaticVNode(getFragmentHTML(instance.vnode.el ?? null, true)?.join('') || '', 1)) : null + return () => isTriggered.value ? h(componentLoader, attrs) : (instance.vnode.el && nuxt.isHydrating) ? createStaticVNode(getFragmentHTML(instance.vnode.el ?? null, true)?.join('') || '', 1) : null }, }) }