mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix: delayed hydration for network idle
This commit is contained in:
parent
28647ecb30
commit
66dd659821
@ -72,7 +72,7 @@ export const createLazyNetworkClientPage = (componentLoader: Component) => {
|
|||||||
const nuxt = useNuxtApp()
|
const nuxt = useNuxtApp()
|
||||||
const instance = getCurrentInstance()!
|
const instance = getCurrentInstance()!
|
||||||
let vnode: VNode | null = null
|
let vnode: VNode | null = null
|
||||||
if (import.meta.client && nuxt.isHydrating && instance.vnode?.el) {
|
if (nuxt.isHydrating && instance.vnode?.el) {
|
||||||
vnode = createStaticVNode(getFragmentHTML(instance.vnode.el ?? null, true)?.join('') || '', 1)
|
vnode = createStaticVNode(getFragmentHTML(instance.vnode.el ?? null, true)?.join('') || '', 1)
|
||||||
}
|
}
|
||||||
const isIdle = ref(false)
|
const isIdle = ref(false)
|
||||||
@ -90,7 +90,7 @@ export const createLazyNetworkClientPage = (componentLoader: Component) => {
|
|||||||
idleHandle = null
|
idleHandle = null
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return () => isIdle.value ? h(componentLoader, attrs) : vnode
|
return () => isIdle.value ? h(componentLoader, attrs) : (instance.vnode.el && nuxt.isHydrating) ? createVNode(createStaticVNode(getFragmentHTML(instance.vnode.el ?? null, true)?.join('') || '', 1)) : null
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user