apollo-client
apollo-client copied to clipboard
Missing docs about aborted requests for V3
After upgrading to Apollo Client V3 - all the unmounted queries are aborted, which throws an error
-
Message: The user aborted a request.
-
Message: Fetch is aborted
-
Message: The operation was aborted.
This is causing a lot of noise in the FE monitoring tools like raygun and etc (https://github.com/apollographql/apollo-client/issues/6769)
Looks like the docs are missing info about this change, I could not find it in either migration guide or in the docs search.
One of the users mentioned that passing the abort controller to the HTTP link helps, but has side effects. https://github.com/apollographql/apollo-client/issues/6769#issuecomment-962437610
With the abort controller passed - the requests are not aborted anymore, and no errors are thrown.
But is this the expected behavior? What is the right way to prevent abort errors to be thrown without breaking internal logic of the apollo client?
@jpvajda hi! Is there anybody from the team available to give an update on this? Just wondering if there is a right way to do it, and still can't find the right solution
@bohdanbirdie 👋 I've added this issuer #6711 which is an umbrella issue for misc documentation updates that the team is currently iterating through. We accept PRs for our docs so if you wanted to make some improvements feel free to submit something and we can review. Thanks for being patient on this request!
Hi @bohdanbirdie 👋🏻 I'm taking a look at this. May I ask a follow-up about this statement?
This is causing a lot of noise in the FE monitoring tools like raygun and etc
The linked issue mentions LogRocket but it appears that there's a broken URL so I don't have access to the full context. Can you explain why you named Raygun? Is there an issue or other artifact we can reference?
Hey @bignimbus That link is from someone else as I can see, could be outdated
We did a fix on our side, for now, to remove the noise from this issue. Our UI is using Raygun for error logging. There is an hook called onBeforeSend
, using it I can ignore the AbortError
error, effectively stopping the reports for canceled requests.
It works, with a catch, all canceled request errors would be ignored, regardless if this is an Apollo or not. Works for us, but might not some someone else.
Thanks for the quick reply @bohdanbirdie! I'm glad that you were able to get things sorted out for that specific scenario. To help developers in the future do you have any suggestions for adding content to the Migration Guide or perhaps the Apollo HTTP Link doc? I'm not sure we would want to suggest using AbortController
considering the potential side effects noted by @luin but maybe we could add a more general note about query cancellation in Apollo Client?
@bignimbus sorry, just noticed your message Out fix is quite specific and does not modify the apollo client in any way
For me it still looks like it would make sense to add docs about the AbortController
, but I don't exactly know what has changed in the Apollo v3 regarding that