-
Notifications
You must be signed in to change notification settings - Fork 3k
Async dispatched config handlers #7344
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
Async dispatched config handlers #7344
Conversation
…ys async dispatch Resolves ReactiveX#7343
29982fd to
4a30be8
Compare
| const sharedSource = source.pipe(share({ resetOnComplete: () => reset, resetOnRefCountZero })); | ||
|
|
||
| const result = concat(sharedSource, firstPause, sharedSource); | ||
| it('should not call "resetOnRefCountZero" on error', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything under this section is really a whitespace change. I'm not sure why the diff is flipping out here. This was just from reorganizing things in the file I think.
|
|
||
| it('should not reset on refCount 0 if reset notifier errors before emitting any value', () => { | ||
| spyOnUnhandledError((onUnhandledError) => { | ||
| describe('when config.onUnhandledError is set', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this describe block is what I think messed with the whitespace diff in other parts of the file.
| expectSubscriptions(source.subscriptions).toBe(sourceSubs); | ||
| }); | ||
|
|
||
| expect(onUnhandledError).to.have.been.calledOnce; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests were errant, in that they were able to check to see if onUnhandledError was dispatched synchronously, which it was never supposed to be.
| function handleStoppedNotification(notification: ObservableNotification<any>, subscriber: Subscriber<any>) { | ||
| const { onStoppedNotification } = config; | ||
| onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber)); | ||
| onStoppedNotification && setTimeout(() => onStoppedNotification(notification, subscriber)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One important bit is here.
| */ | ||
| export function reportUnhandledError(err: any) { | ||
| timeoutProvider.setTimeout(() => { | ||
| setTimeout(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other important bit is here.
This is removing dependency on
timeoutProviderinObservablebecause observable depends onSubscriber, andSubscriberuserstimeoutProviderfor bothonUnhandledErrorandonStoppedNotification, when it doesn't really need to. That's not particularly whattimeoutProvideris for.This also preps us to publish
@rxjs/observableby limiting the dependencies thatObservablehas.Resolves #7343