-
Notifications
You must be signed in to change notification settings - Fork 3k
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
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.
@@ -810,9 +797,22 @@ describe('share', () => { | |||
}); | |||
}); | |||
|
|||
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.
@@ -856,89 +855,86 @@ describe('share', () => { | |||
expectObservable(result, subscription).toBe(expected); | |||
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.
@@ -267,7 +266,7 @@ function createSafeObserver<T>(observerOrNext?: Partial<Observer<T>> | ((value: | |||
*/ | |||
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.
@@ -11,7 +10,7 @@ import { timeoutProvider } from '../scheduler/timeoutProvider'; | |||
* @param err the error to report | |||
*/ | |||
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
timeoutProvider
inObservable
because observable depends onSubscriber
, andSubscriber
userstimeoutProvider
for bothonUnhandledError
andonStoppedNotification
, when it doesn't really need to. That's not particularly whattimeoutProvider
is for.This also preps us to publish
@rxjs/observable
by limiting the dependencies thatObservable
has.Resolves #7343