Consider using AbortController.signal to cancel requests
See original GitHub issueThe .cancel()
method to cancel requests works great, and it’s a great feature to have. It’s a popular convention used by many network libraries, however, a convention notheless.
It would be great to add support for an AbortController.signal
created outside the generated code so as to use a native browser api rather than a convention.
As an example, react-query has started to create it’s own signal
s in addition to still supporting the .cancel()
convention.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to cancel Javascript API request with AbortController
This is where AbortController comes in handy. We can use AbortController to cancel the already initiated request(using fetch). The modern ...
Read more >Canceling API Requests Using fetch() And AbortController In ...
The AbortController is how we trigger that abort event on the signal after it has been passed into the fetch() method.
Read more >Aborting/Cancelling requests with Fetch or Axios
This can be achieved by using AbortController, which is an inbuilt browser interface. ... This signal is passed as a parameter in the...
Read more >AbortController.abort() - Web APIs | MDN
When the fetch request is initiated, we pass in the AbortSignal as an option inside the request's options object (the {signal} below). This ......
Read more >Aborting fetch request with AbortController - miyauci.me
The AbortController has a reference to the signal object and an abort method. You can abort an HTTP request by passing this signal...
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
@ferdikoomen my org would be willing to contribute a fix to use AbortController because CancelablePromise is just a convention and it also causes teams to have to adjust their jest tests in an inconvenient way rather than using built-in
mockImplementation(async () => { ... })
. I just have two questions:Which clients should use AbortController?
Is it OK that we have an additional condition for this in the handlebar(s) file(s)?
This would be great to use with react-query with just being able to pass the signal through.