-
Notifications
You must be signed in to change notification settings - Fork 26.3k
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
with-apollo-app rendering twice #5050
Comments
There's nothing to fix here, it's the way Apollo works: https://www.apollographql.com/docs/react/features/server-side-rendering.html#getDataFromTree Apollo recursively traverses the React render tree looking for Apollo query components. When it has done that, it fetches all these queries and then passes the result to a cache. This cache is then used to render the data on the server side (another React render). This is the reason you're seeing 2 Thanks for taking the time to try and improve the example for everyone though 🙏🙌 Feel free to send a pull request with this additional context to the example readme |
Thank you so much for taking the time to confirm that. When I know next/apollo better I am sure I will do a facepalm for asking that. Your confirmation of that really helps me feel more comfortable getting started now with next! |
🙏 |
Noting per #5050 for new users of Apollo that they should not be concerned about multiple renders.
Examples bug report
Example name
with-apollo-app
Describe the bug
PostList is rendering twice
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Expected behavior
Console log output only shows once.
System information
Additional context
I am completely new to react/next/apollo and trying to learn how to do things right from the wonderful examples. If you could please take a moment to fix the example so that it only renders once, that would make new users much more comfortable knowing they are following the right pattern. Thank you very much for your help.
The text was updated successfully, but these errors were encountered: