-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
combineLatest
of an empty array completes immediately
#1879
Comments
Hi @fb55 , I guess for this one I can imagine a lot of potential behaviors. One could argue that if that array is empty then there are no latest elements so there is nothing to return. Please bear in mind that the implementation will only start to return values once all values are received. 0 is kind of faulty value I guess. On the other hand I can also see a rationale why I would want to double check rxjs here, but we could change this in 5.0 version since this is a breaking change. |
is it not enough to just return feedSubscriptions here? About:
It's normal, none of the |
That is a good explanation, but might not be very intuitive. If you expect an "updating I would also want to argue that returning an array is more useful behavior. |
Hey, I agree with @fb55, I would expect this stream to emit an empty array. If you disagree I challenge you to give an opposite example, in which the user will prefer the return value to be a never-emitting observable that completes immediately. |
This is almost a year and a half old, it would be better if you could open a new issue to track this. Thanks ! @sharshuv-quotient |
Short description of the issue:
Calling
combineLatest
on an empty collection does not produce any elements.Expected outcome:
Intuitively, I expect
combineLatest
to be an updatingmap
of the array, replacing the observables with its elements. Given that there are no elements, I expect to receive an empty array.What actually happens:
The sequence terminates immediately.
Self contained code example that reproduces the issue:
Very basic example, adapted from #1205:
The code I'm actually running:
I never reach the point where there are no subscriptions.
RxSwift/RxCocoa/RxBlocking/RxTest version/commit
4.3.1
Platform/Environment
How easy is to reproduce? (chances of successful reproduce after running the self contained code)
Xcode version:
Installation method:
I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)
Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)
The text was updated successfully, but these errors were encountered: