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.

Consider using AbortController.signal to cancel requests

See original GitHub issue

The .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 signals in addition to still supporting the .cancel() convention.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:6
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
wberncommented, Mar 11, 2022

@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?

    • I’m assuming everything except Angular and XHR, based on code observation and your comment above
  • Is it OK that we have an additional condition for this in the handlebar(s) file(s)?

0reactions
sebasptschcommented, Nov 10, 2022

This would be great to use with react-query with just being able to pass the signal through.

Read more comments on GitHub >

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

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