How can I use getDataFromTree for ssr | apollo client #15736
Replies: 6 comments 19 replies
-
|
recommended approach is to use getStaticProps or getServerSideProps now, as shown in the with-apollo example |
Beta Was this translation helpful? Give feedback.
-
|
What @ananth-minions said is soo key 🔑 . The logic duplication between |
Beta Was this translation helpful? Give feedback.
-
|
I found a way, I don't know if it's the best but is working: in the nextjs's Where for me, the And in a page where I use So, with this, I can do On the other hand, I'm using Apollo's reactive variables if those queries have to be updated because of user interactions for example. So after the mutation, in the It must be a better way, I know. I will update this if I find something or somebody here comes with a better idea |
Beta Was this translation helpful? Give feedback.
-
|
I was commenting in one of the threads, but found a proper solution so wanted to bring it top level. Here's an example using Apollo's The main advantages here:
Code: https://github.com/shshaw/next-apollo-ssr See comments in |
Beta Was this translation helpful? Give feedback.
-
|
Is there a way to use query parameters? For example I have a page |
Beta Was this translation helpful? Give feedback.
-
|
In case anybody stumbles upon this - for us the following works (with other components taken from @shshaw's answer). It doesn't mess with Next rendering logic by applying the This will need |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to render some of the pages on serverside with minimal content and the content will be fetched by using a Graphql (apollo) query.
How can I use
getDataFromTreewithapollo/ssr, to query for graphql on the server side!https://github.com/vercel/next.js/tree/canary/examples/api-routes-apollo-server-and-client-auth
Beta Was this translation helpful? Give feedback.
All reactions