-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[4.0] [Regiression] Unsubscibing from ObservableQuery no longer aborts in flight request #12554
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
Comments
Hey @wassim-k 👋 This was an intentional change done in
This affects any API that calls That said, it probably makes sense for us to allow a way for this to happen. Let me take this to the team and throw around some ideas. Appreciate the feedback here! I'll add this to the 4.0 milestone so that we don't lose track of this. |
Hey @jerelmiller, again thanks for taking the time to explain. Given that GraphQL queries are side-effect free in nature, cancelling them when they're no longer needed (when the user navigates away or sets new variables) is generally a safe operation, especially in cases, as explained above, when the query is resource intensive and can take up to 30s in processing, this can have a noticeable impact on the server load. Furthermore, Angular's built-in That being said, looking at the reason this change was introduced, I understand why it was necessary. Now, forgive my limited React knowledge, but my understanding is that the crux of the problem boils down to the fact that a rejected I may have a suggestion, and let me know if this is too big of a breaking change. return promise.catch(error => ({ data: undefined, error })); and this way it simplifies the use of the API, since the caller can simply: const { data, error } = await execute();
if (error) {
handleError(error);
} and deal with the error (including abort errors) safely without worrying about wraping it in a If this is still not an acceptable solution, I would appreciate having the option to control this behavior at the client level, as it would be considered quite a big breaking change for us. Thanks. |
It's actually a bit more complicated than that 😆. If you want some reading material, check out the comments in the issues of the following (I've got quite a few comments in those issues that explain the background behind these changes in much more detail): The original issue was reported by #10365 because unmounting a component with
Totally agree. I had a chance to catch up with the team today and we decided that it makes sense to have some way to reintroduce this behavior. I'll be noodling some more on this tomorrow and hope to have something up very soon. Whatever we end up with will need to account for the
Since its a major, this is a perfect time for breaking changes 😆! We are ok introducing breaking changes between alphas since that is what alphas are for. Keep the feedback coming!
The only issue I have here is that we'd like to ensure
We will definitely add something back in! Again, I don't know exactly how this will look yet, but we'll get something in place. Once again, appreciate the feedback! |
Hi,
While testing Apollo Client v4, I noticed that when calling
setVariables
on a watched observable query, it no longer aborts in flight http requests. The same is true for simply unsubscribing while the request is in progress.This behaviour has changed since v3 which called
AbortController.abort
as expected.We have some heavy data analytics queries that can run for a long period of time, being able to cancel those if the user changes the paramters or navigates away reduces the load on the server.
There is a comment here explaining the bug, so it seems like that might have been done intentionally, do you mind shedding some light on the thinking behind it.
Thanks.
The text was updated successfully, but these errors were encountered: