Ask questionsChain implementation causes memory leaks


Currently chain is implemented using mergeMap which is known to not unsubscribe from the passed observable on source emit. It's recommended to use switchMap in such cases. Is mergeMap used intentionally here (for some laws to hold) or it can be replaced with switchMap?


Answer questions OliverJAsh

I've been avoiding chain and instead using the RxJS operators (mergeMap/switchMap/concatMap/exhaustMap) so that I'm forced to make an explicit decision about which type of chaining I want to use. However, I would like to start using convenience functions such as Observable.bind/ObservableOption.fold and these rely on Observable.chain under the hood. For this reason I'm starting to think that we need multiple versions of these functions which rely on chain, e.g. Observable.bindSwitch/ObservableOption.foldSwitch which would use switchMap under the hood. We would need a better naming convention though. 🤔


Related questions

No questions were found.
Github User Rank List