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

Update bufferToggle closingSelector to accept promise / empty #1494

Closed
wants to merge 3 commits into from

Conversation

kwonoj
Copy link
Member

@kwonoj kwonoj commented Mar 19, 2016

Description:

This PR updates behavior of bufferToggle's closingSelector

  • accepts closingSelector returns promise
  • handle cases where closingSelector returns immediately

Related issue (if exists):
relates to #1487, #1246

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 95.997% when pulling 6951ac1 on kwonoj:fix-buffertoggle into 9a9baac on ReactiveX:master.

@@ -23,6 +23,34 @@ describe('Observable.prototype.publishReplay', () => {
expect(source instanceof Rx.ConnectableObservable).toBe(true);
});

it('should follow the RxJS 4 behavior and NOT allow you to reconnect by subscribing again', (done: DoneSignature) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

simple test case reordering again, due to jasmine behavior. It seems occuring repeatedly now.

@kwonoj
Copy link
Member Author

kwonoj commented Mar 19, 2016

/cc @staltz for review also as similar to #1490, contains same fixes.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 95.997% when pulling 6951ac1 on kwonoj:fix-buffertoggle into 9a9baac on ReactiveX:master.

@@ -341,4 +342,54 @@ describe('Observable.prototype.bufferToggle', () => {
expectSubscriptions(e1.subscriptions).toBe(e1subs);
expectSubscriptions(e2.subscriptions).toBe(e2subs);
});

it('should accept closing selector returns promise resolves', (done: DoneSignature) => {
Copy link
Member

Choose a reason for hiding this comment

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

I would add the word that here. "should accept closing selector that returns a resolved promise"

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure will do.

@staltz
Copy link
Member

staltz commented Mar 21, 2016

Can we merge this after #1485, and then update this PR to document the use of Promises?

@kwonoj
Copy link
Member Author

kwonoj commented Mar 21, 2016

Since #1485 is ready to check in (plan to do it in morning) and this is still need to be reviewed, order should be as you suggested. I'll update PR once check in #1485.

@kwonoj kwonoj force-pushed the fix-buffertoggle branch 2 times, most recently from 3f5a0fe to e6a9d39 Compare March 21, 2016 17:06
@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 95.997% when pulling e6a9d39 on kwonoj:fix-buffertoggle into 56c9191 on ReactiveX:master.

@@ -44,18 +46,18 @@ import {errorObject} from '../util/errorObject';
* @owner Observable
*/
export function bufferToggle<T, O>(openings: Observable<O>,
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure, but can't openings also be a Promise?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure either, so limited changes for sure thing first.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, anywhere we're accepting an Observable we should accept any of the acceptable types. Although synchronous things like iterators and Arrays don't make sense here. I think we should probably accept Promise though.

Basically, we need to accept interfaces of Promise, Subscribable and IObservable here. (We probably also need better names for those last two, haha)

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, will try to update. Would it be ok to accept SubscribableOrPromise as same as closing?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 96.003% when pulling 0bef1ed on kwonoj:fix-buffertoggle into 56c9191 on ReactiveX:master.

@kwonoj kwonoj force-pushed the fix-buffertoggle branch 3 times, most recently from ecd99ed to dd461e4 Compare March 23, 2016 19:51
@kwonoj
Copy link
Member Author

kwonoj commented Mar 27, 2016

I think change's are ok, but will leave bit more to see any other suggestions around before check this in.

@@ -44,18 +46,18 @@ import {errorObject} from '../util/errorObject';
* @owner Observable
*/
Copy link
Member

Choose a reason for hiding this comment

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

We need to update docs in line 22 to say "an Observable or Promise returned by...".
And update docs in line 40 too.

@benlesh
Copy link
Member

benlesh commented Mar 29, 2016

Looks like this could use a rebase.

@kwonoj
Copy link
Member Author

kwonoj commented Mar 29, 2016

Absolutely, and this PR still need to be updated per suggestion - I'll update it soon.

@kwonoj
Copy link
Member Author

kwonoj commented Apr 5, 2016

PR's updated per suggestion also rebased. I'll leave this PR around day before check in to see any other suggestions around.

@kwonoj
Copy link
Member Author

kwonoj commented Apr 6, 2016

Merged with 3d22c7a.

@kwonoj kwonoj closed this Apr 6, 2016
@kwonoj kwonoj deleted the fix-buffertoggle branch April 6, 2016 06:38
@lock
Copy link

lock bot commented Jun 7, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants