question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature idea: Abort pending requests

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:21 (5 by maintainers)

github_iconTop GitHub Comments

15reactions
klis87commented, Jan 5, 2018

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.

9reactions
felixfbeckercommented, Dec 20, 2017

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found