-
Notifications
You must be signed in to change notification settings - Fork 786
Add test for Query bug which is caused by changing props (#1749) #2718
Conversation
@MerzDaniel: 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 for this @MerzDaniel - something definitely appears to be off in |
Noting this here in-case I'm sidetracked and someone else is interested in taking a look - this test is currently failing because of the query re-subscription logic that happens when the error is received: Line 348 in b591d03
The |
Not sure if this is the same bug but I have had issues with changing props not updating the UI properly. I think the first query made and cached with the first set of props causes issues. Subsequent changes to props and thus queries render fine, but going back to the initial set of props doesn't update the UI. I tried to reproduce using CodeSandbox but couldn't, so I think it needs a real network layer to occur. |
When the Observable subscription created in `startQuerySubcription` receives an error, we only want to remove the old subscription, and start a new subscription, when we don't have a previous result stored. So if no previous result was received due to problems fetching data, or the previous result has been forcefully cleared out for some reason, we shoule re-create a new subscription. Otherwise we might be unnecessarily starting a new subscription the `Query` component isn't expecting, and isn't tying into its update cycle properly.
The bug was reported some months ago and I stumbled over it after 1h of trying out react-apollo. This test show-cases the wrong behaviour and fails.
In the related bug ticket someone already debugged into the cause of this issue.
#1749