Nuxt 3 SSR issues #6419
Replies: 1 comment
-
In my case, it was a cookie issue. I was using a
This means my auth cookie wasn't forwarded, which would cause my API route to throw 401 error for that query during SSR, and query cache not filled. When the component was created on the client and the request was issued, everything worked as expected because the headers (and the cookie) were properly forwarded. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all.
I am using Nuxt 3 + SSR and I am running into an issue with how vue-query behaves.
Behavior
Whenever I hard refresh my Nuxt 3 page, no data is fetched. Whenever I go to another route, and come back, data is fetched successfully. Basically, every time I refresh my page, even when data is literally on that page at the moment, no data will be shown. It's only until after I go to another route and come back that data is fetched again.
I suspect this might have something to do with my custom composable, how SSR behaves, or maybe something else.
Context + Code
This is my setup:
plugins/vue-query.ts
:I also have this composable I wrote, which (may be) part of the issue:
composables/useQueryFetch.ts
:And this is how I use it in my
pages/index.vue
:Beta Was this translation helpful? Give feedback.
All reactions