-
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
withLatestFrom completes with no emissions when input observable has delay #7068
Comments
I would argue that The resulting observable can only emit a value when the piped observable omits a value. The other observables provided to Coming back to your example, that means that Perhaps const source$ = range(1, 3).pipe(
delay(300)
)
const example$ =
source$.pipe(
withLatestFrom(range(1, 3))
)
example$.subscribe(console.log) |
The issue I am noticing is with b1 from the diagram. But when the input has emitted a value and |
So you would like to see an
Emitting |
You are correct. That would be |
For those stumbling upon this issue I solved it like this in my case import { range, combineLatestWith, delay, distinctUntilChanged } from "rxjs";
const source$ = range(1, 3).pipe(delay(0));
const workingExample$ = range(1, 3).pipe(
map((val, i) => <const>[val, i]),
combineLatestWith(source$),
distinctUntilChanged(undefined!, ([[_, i]]) => i),
map(([[val], source]) => <const>[val, source])
);
workingExample$.subscribe(console.log); |
Describe the bug
In the code below
example$
will complete with no emissionsAdding
observeOn(asyncScheduler)
toexample$
makes it work as expectedHowever, bumping the delay to a number above 2 it will make it complete with no emissions again
Expected behavior
When running the code below I expect these emissions after a delay of 300 ms
Reproduction code
No response
Reproduction URL
https://stackblitz.com/edit/rxjs-se9x2m
Version
7.5.6
Environment
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: