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
Component setup runs before router middleware is resolved #15407
Comments
I found a similar issue #15136 Have I understood something differently? |
Would you provide a reproduction? 🙏 |
After updating @sangyookim-ogq repro I still get the error on Nuxt Edge https://stackblitz.com/edit/github-pednm9-5522a8?file=package.json am I missing something @pi0 ? |
your reproduction was not using nuxt edge (if you look in the package-lock.json) - likely a stackblitz issue. the current edge release is unstable but you should be able to test in rc14 shortly. |
https://stackblitz.com/edit/github-pednm9-5522a8?file=pages/index.vue Here it is running RC 14. It seems to still be running code it shouldn't. |
on my local version with Nuxt 3 stable, I'm still getting the issue as well, but partially. I'm not sure if this is intended behavior, but when I refresh the browser from |
This is also causing serverless functions in Vercel to crash, giving a fatal error screen. I am not sure I agree with it being a minor bug. It is definitely not minor for me. Edit: After moving to sidebase/nuxt-auth this is no longer an issue for me. I am not sure how it handles the redirect but it works now, and doesn't cause setup to run. |
Chiming in here - I can reproduce this issue locally as well, similar situation where one of my protected routes still queries the DB after a |
I have same issue. I'm waiting for it to be resolved. |
This issue also appears in |
Environment
Darwin
v18.12.0
3.0.0-rc.13
0.6.1
npm@8.19.2
vite
runtimeConfig
,vite
,modules
,i18n
@pinia/nuxt@0.4.3
,@nuxtjs/i18n@8.0.0-beta.1
-
Reproduction
Describe the bug
I'm seeing that setup block data fetching is being called before router middleware is resolved.
When I visit '/' without authentication, the page redirects to '/login' like expected.
But, on nuxt server console, I'll see that
'/api/some_api_auth_required'
was called andfailed because accesstoken doesnt exist (not authenticated).
Is this normal behavior? If so, how w
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: