-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fromFetch throws AbortError when resubscribed #5233
Labels
bug
Confirmed bug
Comments
It's possible that this was fixed in |
Yeah. You are right. It needs to assigned to a variable that's declared within |
cartant
added a commit
to cartant/rxjs
that referenced
this issue
Jan 15, 2020
cartant
added a commit
to cartant/rxjs
that referenced
this issue
Jan 15, 2020
benlesh
pushed a commit
that referenced
this issue
Jan 20, 2020
martinsik
pushed a commit
to martinsik/rxjs
that referenced
this issue
Feb 15, 2020
* test: add failing test for ReactiveX#5233 * fix: don't reassign closed-over parameter in fromFetch Closes ReactiveX#5233 * chore: add type annotation for variable
cpojer
pushed a commit
to react-native-community/rxjs
that referenced
this issue
Mar 20, 2020
* test: add failing test for ReactiveX#5233 * fix: don't reassign closed-over parameter in fromFetch Closes ReactiveX#5233 * chore: add type annotation for variable
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug Report
Current Behavior
When an Observable created with fromFetch is unsubscribed and then resubscribed, it immediately throws AbortError.
Reproduction
Expected behavior
Each subscription to the observable should be independent. Looking at the code, the problem is that the init object from the function parameters is reassigned within the observable. Since this variable is from the closure it is shared across subscriptions, so subsequent subscriptions use the same abort signal which was already aborted and therefore always abort immediately.
Environment
Possible Solution
Instead of reassigning to the function parameters, assign to a local variable within the Observable.
As a workaround, always wrapping the fromFetch in defer should work.
The text was updated successfully, but these errors were encountered: