These are chat archives for ReactiveX/RxJava

11th
Sep 2017
Artem Rudometkin
@perfectplayer
Sep 11 2017 08:37
Seems like you want to filter your items.
Ilya Krol
@ilya_krol_twitter
Sep 11 2017 16:41

Hi everyone! I am struggling to find a way to execute the command currently in the 'andThen' only when the upstream completable completes successfully without an error. Is there a better way other than saving the error state in a variable, which is quite ugly?

someValue
    .toSingle()
    .flatMapCompletable { possiblyExceptionCompletable }
    .andThen(updateInteractor(success))
    .onErrorResumeNext { updateInteractor(failure) }

In this scenario if possiblyExceptionCompletable throws an exception - both the success and failure updates occur.

Exerosis
@Exerosis
Sep 11 2017 17:10
if I were to do: test.switchMap(blah) when test completes does the most recent observable get unsubscribed?
@ilya_krol_twitter
value.flatMap(ignored -> opThatMightFail()
                                    .map(result -> new State(result)) //result is in
                                    .startWith(new State()) //Loading
                                    .onErrorReturn(throwable -> new State(throwable)))
           .doOnNext(state -> updateInteractor(state))