Nuxt + Apollo : what is the best way to fetch data.

I'm setting up a Nuxt project with Apollo and I want to leverage SSR. There is a Nuxt/Apollo package, but it doesn't seem to be actively mainained and there are some issues with it. Therefore I was thinking to use Vue Apollo. I have a couple questions regarding how to set this up, and how to best fetch data. Is useQuery safe to use with SSR? Using useQuery doesn't seem to be optimized for SSR. It's not possible to await useQuery or wrap it inside useAsyncData, since it's not a promise. So, it feels like this is not the best way to fetch data on the server side. Is this assumption correct? Or would it be fine to use useQuery server side? Would making a custom useAsyncQuery make sense? I really liked what Nuxt/Apollo did with their useAyncQuery implementation. This allows me to await the query on the server side, which is exactly what I want. I made a custom implementation in this code sandbox, but I feel like I'm maybe oversimplifying things a lot. Is this the right direction, or am I missing something? Are there any other (better) ways to fetch data with Apollo when using Nuxt + Apollo + SSR or am I heading in the right direction?
GraphQL integration for Nuxt · Docus
The best place to start your documentation.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server