Any SSG examples using Next.js + Apollo? #10661
-
I'm interested in trying out the new |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
Would recommend not using Apollo and just doing a simple |
Beta Was this translation helpful? Give feedback.
-
How would you deal with usecases where the client needs to take over e.g. to refetch a query, or to use polling? I guess it would work to use something like graphql request first, pass in the data, then in the actual component set up the apollo query in a typical way, probably a hook now, and ignore that initial data as soon as newly fetched is available, but I was wondering if there is a more seamless approach which does the work once e.g. in the withApollo HOC, while also supporting more edge cases. For example, lets say I have such a specific use case that I dont want to do a separate query on the client, but only have a mutation which would update the cache of existing data that was statically fetched. And then, maybe I even have several of them on separate pages, so on the client I would need to have all necessary data available in the apollo cache. HOCs wrapping a page will have access to the data which was fetched in getStaticProps of the page, so it would be possible to add to the cache from there. But on the other hand, it would be nice to have a solution where I don't need to specify these queries twice and just have a useQuery somewhere in the Code and that would be fetched on SSG. |
Beta Was this translation helpful? Give feedback.
-
Heres a small example: #11957 (comment) |
Beta Was this translation helpful? Give feedback.
Heres a small example: #11957 (comment)