fix always call onNext

use defaultIfEmpty to prevent filtering from collapsing observable
pipeline early
This commit is contained in:
Berkeley Martinez
2015-07-11 18:40:15 -07:00
parent e04c11c2e7
commit 799f4736d7

View File

@ -41,14 +41,16 @@ module.exports = function(app) {
.flatMap(function(user) { .flatMap(function(user) {
debug('saving user'); debug('saving user');
return saveUser(user); return saveUser(user);
}); })
// always call onNext
.defaultIfEmpty(null);
var query = { where: { dashedName: { like: dashedName, options: 'i' } } }; var query = { where: { dashedName: { like: dashedName, options: 'i' } } };
debug('find fieldGuide', query); debug('find fieldGuide', query);
Rx.Observable.combineLatest( Rx.Observable.combineLatest(
// find that field guide // find that field guide
findOneFieldGuide(query).tap(function() { console.log('foo'); }), findOneFieldGuide(query),
userSave, userSave,
Rx.helpers.identity Rx.helpers.identity
) )