-
Notifications
You must be signed in to change notification settings - Fork 786
Resubscribe after error -- apollo-client issue 2513 #1531
Resubscribe after error -- apollo-client issue 2513 #1531
Conversation
Hotfix for apollo-client issue 2513. When a query has an error, Zen Observables will terminate the subscription, so the react component no longer receives updates. This commit adds a simple resubscribe method and calls it when an error occurs.
@wdimiceli: 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/ |
@excitement-engineer if this looks good, we need to mirror the tests and changes to @wdimiceli if you want to increase bundle maxSize in the package.json and push it that will solve the build error. 4.8 will be fine. |
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.
This looks good to me, but I'm no authority in this area. I would prefer @jbaxleyiii and @excitement-engineer give their approval.
Is there a chance this will be released on NPM any time soon? Pretty, pretty please 😄 |
Please check the releases tab before posting. We are going to try and release more frequently and this most certainly has been released (though strangely danger did not require a changelog entry for it). Try the 2.1 beta: https://github.com/apollographql/react-apollo/releases |
@rosskevin Sorry, wasn't aware of the beta releases, just checked npm stable. Thanks! |
Unfortunately, this didn't resolve #1385 for me 😞 . However, installing the beta release of |
@nfantone I have upgraded to all of those versions with I'm finding that when their is an error in a component, the loading prop is false, however none of the props are passed to the component. I'm using a sub-resolver and testing when there is an error in that single "sub-function." Everything works as expected in GraphQL – when there is an error, that single property is However, because there is an error, none of the partial result gets passed to the component 😕 |
@AndrewHenderson I might be misunderstanding, but partial results sound like a job for |
@edorivai That’s exactly the setting I needed. I completely missed that. Thank you! 😁 |
@AndrewHenderson Actually, what I'm seeing is that now the @edorivai Would you have any input on this? Would this be the intended functionality? |
Hey guys, sorry to disappoint you, but I'm no authority on this lib 😅,
just another user.
@AndrewHenderson I didn't try it with the Query component yet. But I would
expect it should be possible to implement if it isn't yet.
…On Fri, Feb 9, 2018, 22:23 Andrew Henderson ***@***.***> wrote:
@edorivai <https://github.com/edorivai> I tried using errorPolicy, but
I’m still experiencing what @nfantone <https://github.com/nfantone> has
described.
I thought it might work using the new Query component, but don’t see an
errorPolicy propType for that new component.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1531 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAutrq9-Z_Emh9SNz16SnjVVdouo4IILks5tTLdogaJpZM4RXISX>
.
|
I could be misunderstanding but I suspect this does not work with polling queries (I haven't been able to make it work), because Perhaps if the query has |
Hi guys, checking in to see if anybody knows when this might be released — desperately need this to re-establish connection after an error (to give the user a way to reload). Thanks, and sorry for the bump. |
This is really breaking, we are are using react-native and apollo, and whenever i go to elevator (which most of the time has not data connection), my app gets error, and even when i get back to wifi connection, my connection cannot be recovered. Correct data are being pull from the server, but the component are not updated |
This is a fairly minimal fix for React components ceasing to get updates after an error occurs in a query. It happens due to the way observables work.. they will terminate a subscription after the error handler is called. Without going through and reconsidering all of the subscription logic between react-apollo and the client, simply resubscribing on error seems like the simplest way to get it working again. A unit test was written to cover this scenario.
Here is the most relevant issue:
apollographql/apollo-client#2513
I have seen several others which might be resolved with this fix.