-
Notifications
You must be signed in to change notification settings - Fork 10
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
calling useVingKind().all() when doing an SSR without a middleware causes Nuxt to crash #168
Comments
I have learned a few things:
|
Turns out if you create a middleware that just fetches anything at all, that will also work around this problem. export default defineNuxtRouteMiddleware(async () => {
await $fetch(`/api/v1/test`);
}); |
This bug is caused by something in The first call to useVingKind() .all() is fine in SSR, but a secondary call will crash unless it has a middleware that fetches something with Alternatively, don't call all, and instead just run the code you want to run in the page rather than inside the useVingKind() composable. I hate that we have to have this work around, but I can't figure out any other way to solve this problem. Hopefully whatever is broken inside of Nuxt will be fixed in the future. |
It turns out that the last middleware must have something that fetches. And it's not good enough to potentially have a fetch in it, it must actually make the call. Thus caching can impede this. |
Try to make a reproduction that can be reported to Nuxt. |
possibly related: nuxt/nuxt#27660 |
The users page doesn't have this problem, and it has two kinds of authentication middleware that both use useCurrentUser. You can use it as a test page for Ving by switching |
The text was updated successfully, but these errors were encountered: