-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Nested "useAsyncData" fails on SSR and works on the client #15596
Comments
I think you should not need to nest
There is a real issue with useAsyncData and composable, but your example doesn't fit in the schema. Maybe if you give more input, I can help. |
Await breaks composables flow. You can use await after await only in setup logic where compiler do some magic tweaks to work as expected. See #12923 |
@RozbehSharahi & @misaon thank you for your responses. This issue came up when I attempted to write a composable which nested two of my other composables. I did so believing that was the indented purpose of composables guided by the Vue composable docs:
If I'm reading your responses (and the thread #12923) correctly, multiple Can you please help me understand the Nuxt-recommended approach for writing sharable async composables? Is that not possible and are we limited to only having single async composible nested? Thank you. |
Let's track documentation improvements to this in #14723. |
Late to the party but encountered this issue as well today and documented my workaround on stackoverflow @nemtsov. Don't know if that's the recommended way to do things, but it works. |
Environment
Reproduction
/pages/test.vue
/pages/testAsync.vue
/composables/testAsync.ts
/test
"ERR: "Error: nuxt instance unavailable"
Describe the bug
The code above returns an error
Error: nuxt instance unavailable
on the server but works as expected on dynamic navigation to this page on the client.Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: