refactor: set hydrated value in nuxt plugin

This commit is contained in:
Daniel Roe 2023-01-02 00:18:05 +01:00
parent b48a893614
commit 0187763c29
No known key found for this signature in database
GPG key ID: 22D5008E4F5D9B55
2 changed files with 5 additions and 7 deletions

View file

@ -1,8 +1 @@
export const isHydrated = ref(false)
if (!process.server) {
const nuxtApp = useNuxtApp()
nuxtApp.hooks.hookOnce('app:suspense:resolve', () => {
isHydrated.value = true
})
}

View file

@ -0,0 +1,5 @@
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hooks.hookOnce('app:suspense:resolve', () => {
isHydrated.value = true
})
})