Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nuxtApp.isHydrating is always false in page setup script when using async page #14839

Closed
mmis1000 opened this issue Sep 8, 2022 · 0 comments · Fixed by nuxt/framework#7940
Closed

Comments

@mmis1000
Copy link
Contributor

mmis1000 commented Sep 8, 2022

Environment

Nuxi 3.0.0-rc.9
RootDir: /home/projects/github-gagmal-zapxnv
Nuxt project info:


  • Operating System: Linux
  • Node Version: v16.14.2
  • Nuxt Version: 3.0.0-rc.9
  • Nitro Version: 0.5.1
  • Package Manager: npm@7.17.0
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-gagmal-zapxnv?file=pages/index.vue

Open /sync, /a, /b/b1, /c/c1
Watch the client console to see if the app is hydrated or not.

Describe the bug

The nuxtApp.isHydrating becomes false before async page component is resolved.
And it also affect all nested page of the async page (no matter it is async or not).

Additional context

I am writing an app. And I want to get fresh data without the initial request.

To achieve that. I am writing it like

const a = await useFetch('url', () => {
  initialCache: !!process.server || nuxtApp.isHydrating
})

so it will only try to actually fetch the data if it isn't initial load.
But it turns out it always say the page is hydrated if I am using async page.
Which is completely unexpected.

Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants