-
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
Different behavior of takeUntil in RxJS 5 and 6 #3727
Comments
Thanks for replying to this issue and pointing me to the corresponding PR. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
RxJS version: 6.2.0
Code to reproduce:
Expected behavior: There are a two core streams involved in the code above,
results$
andfails$
.fails$
is based off ofresults$
and filters out all truthy source values, meaning it only emits falsy values.results$
should now emit values untilfails$
produces a value. So whenresults$
synchronously emits 3 values[true, true, true]
,fails$
should never emit and it doesn't because of the filter operator. Hence the observer passed tosubscribe
should be called 3 times.Actual behavior:
The next callback should be called 3 times. However, no values are propagated via the observer passed to
results$.subscribe(...)
. WhentakeUntil
is removed, everything works as expected. Even if I leavetakeUntil
in and only change thenotifier
to something likeinterval(1000)
, it works as expected.Here's a StackBlitz that demonstrates the issue.
It somehow makes sense in this situation as everything is happning synchronously. This means that
takeUntil
creates a subscription tofails$
, which then subscribes toresults$
. The thing is thatresults$
emits synchronously whentakeUntil
subscibres and it completes so the outer subscription onresults$
will never receive any values. This is just a guess and my shot at explaining this behavior. The weird thing is that it works when using RxJS 5.5.11. Is this some edge case that was "fixed" in RxJS 6 or which one is incorrect?Here's a runnable demo on StackBlitz.
We have noticed the issue while upgrading MachineLabs to RxJS 6.x. Here's the corresponding PR. Due to failing tests we were able to spot a different behavior, so we started to investigate.
The text was updated successfully, but these errors were encountered: