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 }}
This repository was archived by the owner on Sep 26, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 26, 2022. It is now read-only.
Is your feature request related to a problem? Please describe.
On the web, fetch have an abort mechanisms, the AbortSignal
According to the documentation there is the webFetchExtra parameter which accept a signal.
But there doesn't seem to be an equivalent for native targets. Is this by design or an oversight?
I usually abort requests in React's useEffect to avoid the "Can't perform a React state update on an unmounted component" error. For example:
Describe the solution you'd like
For the native targets to support the signal parameter, which would accept an AbortSignal instance such as on the web.
Or for Http.request (get, post, etc) to return both the response's Promise and a cancel method.
Describe alternatives you've considered
Implementing abort on top of Http by wrapping the Http promise in an other Promise which reject whenever the signal emit the abort event
I left a PR (#193) trying to solve this. It's actually a little complicated 😅, since we need to track down the abortable requests and close their respective sockets. Currently, it's not working on iOS, though.
Activity
dfidalg0 commentedon Nov 10, 2021
I left a PR (#193) trying to solve this. It's actually a little complicated 😅, since we need to track down the abortable requests and close their respective sockets. Currently, it's not working on iOS, though.