Skip to content

[Feature]provide a way to cancel a fetch request #5590

Closed

Description

@SuBeibei

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".

Activity

  1. facebook-github-bot commented on Jan 28, 2016

    @facebook-github-bot
    Contributor

    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.

    • 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!
  2. satya164 commented on Jan 28, 2016

    @satya164
    Contributor

    fetch doesn't have a way to cancel the request as per the Promise spec. You can use XMLHttpRequest directly if you need to cancel the request.

  3. hfossli commented on Apr 1, 2017

    @hfossli
    Contributor

    I would love to see this reopened.

  4. ssssssssssss commented on Feb 24, 2018

    @ssssssssssss
  5. ahmadalfy commented on Mar 6, 2018

    @ahmadalfy

    fetch is now cancellable via AbortController

    The final version of AbortController has been added to the DOM specification
    The corresponding PR for the fetch specification is now merged.

  6. locked as resolved and limited conversation to collaborators on May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions