-
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
combineAll does not emit on empty array #1910
Comments
var arrayOfStreamsStream = Rx.Observable
.of(
[], [
Rx.Observable.of('blah-1'), // component state.
Rx.Observable.of('blah-2'),
Rx.Observable.of('blah-3')
], [], [
Rx.Observable.of('foo-1'),
Rx.Observable.of('qux-2')
]
)
.switchMap(function onMap(coll) {
return coll.length === 0 ?
Observable.of(coll) :
Observable.combineLatest(...coll);
})
.subscribe(function onSubscribe(data) {
console.log('onSubscribe START')
console.dir(data)
console.log('onSubscribe END')
}) |
I will totally accept that as a good solution! Many thanks. Please post to Stackoverflow if you'd like an accepted answer, or tell me otherwise so I can post it and close that one. |
Wrote the answer on SO. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Using rxjsv5 combineAll, I have an issue forming a state tree of children states.
If I have an array of state streams, I can get the state data in an array corresponding to the streams. But if I switchMap from an array with n state streams to an array with zero state streams (empty array), combineAll will not emit anything.
This makes the app state tree contain the old state data of the last non-empty array of state streams.
I have fixed it right now by mapping the array of state streams to always concat a dummy stream with a dummy value, which is really confusing for other developers looking at the code and state tree.
The text was updated successfully, but these errors were encountered: