You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]provide a way to cancel a fetch request #5590
I sent a request using fetch in "componentDidMount", then I try to cancel it in "componentWillUnmount".But I didn't find a way to do it.I notice that in Android NetworkingModule provides method "abortRequest".
React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!
Activity
facebook-github-bot commentedon Jan 28, 2016
Hey SuBeibei, thanks for reporting this issue!
React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
react-nativeor for more real time interactions, ask on Discord in the #react-native channel.satya164 commentedon Jan 28, 2016
fetchdoesn't have a way to cancel the request as per the Promise spec. You can useXMLHttpRequestdirectly if you need to cancel the request.hfossli commentedon Apr 1, 2017
I would love to see this reopened.
superandrew213 commentedon Apr 21, 2017
@hfossli use https://github.com/apentle/react-native-cancelable-fetch
ssssssssssss commentedon Feb 24, 2018
Shall we reopen this for the AbortController? http://mo.github.io/2017/07/24/abort-fetch-abortcontroller-polyfill.html
ahmadalfy commentedon Mar 6, 2018
fetchis now cancellable viaAbortControllerThe final version of AbortController has been added to the DOM specification
The corresponding PR for the fetch specification is now merged.