Open daffl opened 7 years ago
You also need to choose if you want to switch or merge. e.g. classic pagination vs infinite scrolling. How about this:
find(params$, merge = false){
if(isObservable(params$)){
return merge
? params$.mergeMap(params => this.find(params))
: params$.switchMap(params => this.find(params));
} else {
return this._find(params$); // "normal" find
}
}
Edit: I think switching should be the default behavior.
Basically, if one of the arguments (or the
params.query
) is an observable we should do what was suggested in https://github.com/feathersjs/feathers-reactive/issues/39 andmergeMap
them into a single stream: