Feature idea: Abort pending requests
See original GitHub issueI saw that in the middleware the req
object has a request
object with operationName
.
{query: Object, variables: Object, operationName: "Search"}
So I’m figuring out a way to cancel previous request with the same operationName.
Motivation
The motivation behind is to use this feature on search’s autocomplete/suggestions.
So when a new query is made we cancel the last request if it is not completed yet, so make it easy to treat the asynchronism in the frontend.
Issue Analytics
- State:
- Created 6 years ago
- Comments:21 (5 by maintainers)
Top Results From Across the Web
Abort pending requests #8858 - apollographql/apollo-client
I need this. We have a feature where admins can log in as different users, and when they do we invalidate and refetch...
Read more >How to abort pending query requests? - GIS Stack Exchange
You need to create a new AbortController and reference its Signal signal: controller.signal in the options object in the queryFeatures ...
Read more >How to abort pending IT Shop requests - Forum - One Identity
Is it possible to abort requests that have been pending for > x days? Manually in Manager or Object Browser or using a...
Read more >AngularJS abort all pending $http requests on route change
There's a pendingRequests service that has an API for adding, getting and cancelling requests, a httpService that wraps $http and makes sure all ......
Read more >Practical use case of the Abortcontroller and Axios cancel token
Providing users the ability to cancel a pending request. · Aborting an ongoing request when a user leaves a page. · Canceling pending...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think this feature is really needed. For example, lets say some private data is being fetched and user clicks logout. With a slow network, we could have a race condition, when private data would arrive after user logged out. Aborting a pending request in the case like this would prevent such a disaster.
The latest version of the fetch API is cancellable (implemented in Firefox and Edge, easy to polyfill): https://developer.mozilla.org/en-US/docs/Web/API/AbortController
Any plans to implement that?