-
Notifications
You must be signed in to change notification settings - Fork 786
Fix component stuck in loading state for network-only fetch policy #3126
Fix component stuck in loading state for network-only fetch policy #3126
Conversation
@jasonpaulos: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/ |
Thanks very much for working on this @jasonpaulos - this has been a long standing React Apollo issue, so it's great to see traction here! Looking this over, I think now might be a good time to take this solution further. The reason why your In the current When we force a component to re-render in This is where the crux of the issue really comes in. The real problem here is the fact that we're asking for data from an This is definitely a bit convoluted to explain, but to make matters worse here we're leveraging If we take a step back here a bit and think this through, we should be able to find a way to always make sure that if our I'll setup a meeting to discuss this further (cc @benjamn). You're definitely headed in the right direction on this, and it would be amazing to finally nail this problem down once and for all. Thanks again @jasonpaulos! |
This commit streamlines some of the React Apollo <--> Apollo Client communication points, to help reduce temporary placeholders and variables used by React Apollo to control rendering. The current data result that is to be rendered now comes from only one place, the initialized `ObservableQuery` instance.
I've added changes in 5839fb9 to help address the issues raised in #3126 (comment). The current result to be used/displayed is now aligned across the entire component, and render tracking/control is now managed via a single instance variable called |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy we took this opportunity to simplify Query
state management! I left a few small comments, but I think this is pretty much ready.
Due to inconsistencies between
Query.lastResult
and the actual previous result passed to the child component for rendering, sometimes theQuery
component would suppress a render that contained necessary data to bring a component out of a loading state. Concretely, this happens when using anetwork-only
fetch policy and the variables of a query changes but the result remains the same.See #2899 for a complete description of the issue.