diff --git a/composables/hydration.ts b/composables/hydration.ts index 98fad034..094b16cc 100644 --- a/composables/hydration.ts +++ b/composables/hydration.ts @@ -1,8 +1 @@ export const isHydrated = ref(false) - -if (!process.server) { - const nuxtApp = useNuxtApp() - nuxtApp.hooks.hookOnce('app:suspense:resolve', () => { - isHydrated.value = true - }) -} diff --git a/plugins/hydration.client.ts b/plugins/hydration.client.ts new file mode 100644 index 00000000..7a7e7805 --- /dev/null +++ b/plugins/hydration.client.ts @@ -0,0 +1,5 @@ +export default defineNuxtPlugin((nuxtApp) => { + nuxtApp.hooks.hookOnce('app:suspense:resolve', () => { + isHydrated.value = true + }) +})