react / react/react-native

AbortSignal/AbortController doesn't work

オープン
#50,015 コメント 15 件 リアクション 14 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Needs: Attention Needs: Repro Newer Patch Available
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
4

説明

Description
  • AbortController / AbortSignal are used in javascript to cancel a request started with fetch, or any other async task that should be cancellable (docs here)
  • In react native, there are several issues with these APIs:
    • DOMException, which is thrown when AbortController is used, doesn't actually exist as a type
    • Calling abortController.abort() doesn't actually have any effect, and abortSignal.reason is undefined.
    • abortSignal.throwIfAborted() doesn't exist as a function
    • I haven't fully verified this, but it looks like AbortController doesn't actually fully abort fetch requests.
Steps to reproduce
  • Use javascript AbortController the way it's documented here
React Native Version

0.76.1

Affected Platforms

Runtime - Android, Runtime - iOS

Output of npx @react-native-community/cli info
System:
  OS: macOS 15.3.1
  CPU: (14) arm64 Apple M4 Max
  Memory: 175.34 MB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.14.0
    path: ~/.nvm/versions/node/v22.14.0/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v22.14.0/bin/yarn
  npm:
    version: 10.9.2
    path: ~/.nvm/versions/node/v22.14.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/luisfinke/.rvm/gems/ruby-3.2.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23726.103.2422.13103373
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 23.0.1
    path: /usr/bin/javac
  Ruby:
    version: 3.2.0
    path: /Users/luisfinke/.rvm/rubies/ruby-3.2.0/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.1
    wanted: 0.76.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Stacktrace or Logs
N/A
Reproducer

N/A

Screenshots and Videos

No response

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Android と iOS の React Native 0.76.1 における AbortController と AbortSignal の文書化された使用方法から始め、abort()、reason、throwIfAborted()、および fetch のキャンセルを確認します。観測された動作を期待される Web API の動作と比較します。報告されたこれらの API の動作が正しくサポートされるか、残っている制限がテストによって明確にカバーされた時点で作業は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, react-native
領域
mobile
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
説明が足りない
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。