Hey guys, I've read multiple blogs explaining "Don...
# rx
b
Hey guys, I've read multiple blogs explaining "Don't break the chain" practice. I recently reviewed my colleague's code where there are two flows inside `Single`'s subscription. In if condition, he has subscribed to an observable and in else, he is just doing non-observable calls. I wanted him to use
flatMapObservable
before Single's subscription and handle if-else flow in
flatMapObservable
. This is to follow not breaking the chain philosophy and having a single subscription. His argument was, anyways Single's subscription would end before calling Observable's Subscription. So, why bother to keep it in a single chain. As in, when the Observable inside Single's subscription gets susbcribed, it is indeed a single subscription. Is this okay? For ex:
Copy code
Single.fromCallable {
 getUser().isVerified
}.subscribe ({
   if(it) view.showVerified
   else subscribeToUserObservable()
})