Skip to content
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

1.x: Single add doOnEach #4461

Merged
merged 2 commits into from
Sep 5, 2016
Merged

1.x: Single add doOnEach #4461

merged 2 commits into from
Sep 5, 2016

Conversation

vanniktech
Copy link
Collaborator

Really not that happy with onNotification.call(Notification.<T>createOnNext(t)); do you guys have any other way of doing this? There's no way of creating a Notification that has the onCompleted plus a value. A new one could be introduced there though. Also the doOnEachSuccess test feels clunky.

Also why does Single when using the do methods does the job by using an Observable? And later converting it back to a Single again. Is it due to the way Single was implemented in 1.x? With Completable there is no converting of back and forth needed.

Javadoc will follow once we sorted out the few nits here.

Fixes #4457

@codecov-io
Copy link

codecov-io commented Sep 1, 2016

Current coverage is 84.28% (diff: 100%)

Merging #4461 into 1.x will increase coverage by 0.09%

@@                1.x      #4461   diff @@
==========================================
  Files           271        272     +1   
  Lines         17607      17647    +40   
  Methods           0          0          
  Messages          0          0          
  Branches       2684       2687     +3   
==========================================
+ Hits          14824      14874    +50   
+ Misses         1923       1913    -10   
  Partials        860        860          

Powered by Codecov. Last update 11343ae...0ea399f

throw new IllegalArgumentException("onNotification is null");
}

Observer<T> observer = new Observer<T>() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not natively subscribe with a subscriber that forwards to the action?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just looked at doOnError & doOnSuccess. If so those should be changed too, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please.

@vanniktech
Copy link
Collaborator Author

I'll continue this on Monday and make all suggested changes

@vanniktech
Copy link
Collaborator Author

vanniktech commented Sep 5, 2016

ExceptionsTest#testOnErrorExceptionIsThrownFromSingleDoOnSuccess fails although I'm not quite sure what the purpose of that test is. Also it seems a bit off to me. Can you give some insights there?

@akarnokd
Copy link
Member

akarnokd commented Sep 5, 2016

Looks like removing the toObservable.toSingle no longer wraps the subscriber into a SafeSubscriber and the test just crashes with a different exception.

@vanniktech
Copy link
Collaborator Author

No exception is being thrown at all.

@akarnokd
Copy link
Member

akarnokd commented Sep 5, 2016

Can you single step the test? In the orginal DoOnEach, it has throwifFatal an throwOrReport you missed btw.


@Experimental
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javadoc?

/**
* Modifies the source {@link Single} so that it invokes an action when it calls {@code onSuccess} or {@code onError}.
* <p>
* <img width="640" height="310" src="https://raw.githubusercontent.com/wiki/ReactiveX/RxJava/images/rx-operators/doOnEach.png" alt="">
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might need a new image here since there's no onNext

@akarnokd
Copy link
Member

akarnokd commented Sep 5, 2016

👍

@akarnokd akarnokd merged commit c307e4f into ReactiveX:1.x Sep 5, 2016
@vanniktech vanniktech deleted the 1.x_single_do_on_each branch September 5, 2016 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants