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
Since rxjs 7 passing empty array into combineLatest and filling it later doesn't work as it immediately closes subscription even though we haven't subscribed yet.
Expected behavior
combineLatest waits until subscription and only then decides whether array is actually empty.
Reproduction code
e.g. this code worked in 6.6.2 but doesn't work anymore in 7.5.7
The text was updated successfully, but these errors were encountered:
mkhodan
changed the title
passing empty array into combineLatest immediately closes subscription prematurely
passing empty array into combineLatest closes subscription prematurely
Nov 4, 2022
This looks like it's happening because we're examining the array given prior to subscription, we're not assuming that someone might mutate the array after that.
The workaround for now would be to create the array prior to passing it to the combineLatest. If that doesn't work, you can always wrap the combineLatest in a defer.
Describe the bug
Since rxjs 7 passing empty array into combineLatest and filling it later doesn't work as it immediately closes subscription even though we haven't subscribed yet.
Expected behavior
combineLatest waits until subscription and only then decides whether array is actually empty.
Reproduction code
e.g. this code worked in 6.6.2 but doesn't work anymore in 7.5.7
please note that if we create array with at least 1 observable already there this works as expected in rxjs 7:
let observables = [of(-1)];
Reproduction URL
https://stackblitz.com/edit/rxjs-6-daddo-playground-is6lgj?file=index.ts
https://stackblitz.com/edit/rxjs-7-playground-3urg4j?file=index.ts
Version
7.5.7
Environment
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: