feat: render app shell with ssr to improve loading experience (#448)
This commit is contained in:
parent
b545efeacc
commit
9395b7031e
35 changed files with 169 additions and 127 deletions
14
composables/hydration.ts
Normal file
14
composables/hydration.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
export const isHydrated = computed(() => {
|
||||
if (process.server)
|
||||
return false
|
||||
|
||||
const nuxtApp = useNuxtApp()
|
||||
if (!nuxtApp.isHydrating)
|
||||
return false
|
||||
|
||||
const hydrated = ref(false)
|
||||
nuxtApp.hooks.hookOnce('app:suspense:resolve', () => {
|
||||
hydrated.value = true
|
||||
})
|
||||
return hydrated
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue