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
Get rid of ssrForceFetchDelay #4814
Comments
This is way better than the setTimeout that ssrForceFetchDelay does. I've had to set our apps delay time to 1000. This solution has solved our constant delay tweaking. Thanks for posting it. |
Made a hooks version of this approach: |
2 tasks
jimrandomh
added a commit
to ForumMagnum/ForumMagnum
that referenced
this issue
Jul 14, 2020
As suggested in apollographql/apollo-client#4814 , ssrForceFetchDelay is bad because it can lead to cascading refetches on load, if something being unexpectedly slow pushes the timeline past the delay duration. Instead, explicitly disable and reenable network fetches before and after rehydration.
This is far better than the |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
ssrForceFetchDelay
is a huge workaround for SSR. It is not working if you set too small value especially if you have any asynchronous initialization e.g.react-loadable
. I've just spent some time fixing this problem in my project and realized that there is an obvious solution on how to tellapollo-client
to not fetch data from API on the first load. The code will explain everything:React DOM
hydrate
andrender
receives as a 3rd argument a callback which works the same ascomponentDidMount
. When the callback is called all components are already rendered.We can go further and do this in
ApolloPrivider
What do you think?
❤️ this project!
The text was updated successfully, but these errors were encountered: