-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OperatorDoOnEach breakes latter subscribtions after error wrapping lift #1689
Comments
The same issue occurs if we replace |
Since THROW_ON_ODD will throw IllegalArgumentException when Actually you don't need to implement a new operator. You can use o.map(i -> new Option<Integer>(i)).onErrorReturn(e -> new Option<Integer>(e)) |
I wouldn't use custom operator if I redesigned my application architecture so now I don't have this issue. However I don't know if this situation is or is not bug. |
There is no guarantee how this will behave as you are attempting something which breaks the Rx contract by trying to send In other words, |
Thanks for clarification. As I wrote before I found other design solution for building UI with Rx, I should share it. Our community lacks few chapters of best practices IRL development. Correct me if I'm wrong, but Rx contract doesn't say anything about signal propagation if subscriber has unsubscribe. Will all the |
Note here how the child This means when the child unsubscribes it is affecting the parent directly, there is no decoupling. Any operator can check The Rx contract for
There are some operators however that do make guarantees. For example |
Anything further on this? |
Thanks for that great explanation. I think we're done with it. |
I have failing test:
final AtomicInteger count = new AtomicInteger(3);
All the magic is in
lift
in which I wanted to have error wrapping using something similar to com.google.common.base.Optional. So whenonError
is emitted I wrap it toerror result
and whenonNext
is emmited I wrap itvalid result
. Whole test source is here: https://gist.github.com/novemberox/e2b1b4e289ac45162847Problem is with line marked as #3 and #4, if any of those is not commented test fails. Order of lines #1-4 doesn't matter, result is always the same. Since
doOnXXX
is side effect that shouldn't affect core observable I think is a bug.You might ask me while I'm trying to treat error as valid data. Common thing is to have some action triggered from UI that would trigger some IO action and display result back to the UI.
I wanted have my UI to be expresed more as FRP so when UI is created I want to have few Subjects that would emit data events like text change or button clicked this way I can do all my business logic it that very moment.
However that is not working at all with Rx paradigm that after
onError
nothing should be emitted. This paradigm doesn't work well with UI, because I want to be able do IO at every button click event if it fails, my UI can handle both error and result nicely.The text was updated successfully, but these errors were encountered: