-
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
fix: finalize behaves well with useDeprecatedSynchronousErrorHandling #6251
fix: finalize behaves well with useDeprecatedSynchronousErrorHandling #6251
Conversation
Adds tests and ensures a few more scenarios that were hit in Google because they use the deprecated synchronous error handling. fixes ReactiveX#6250
Just for readability. The deprecated stuff is a hot mess, and this shows what we get to delete in version 8 more cleanly.
|
||
subscriber.add( |
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.
I split this up, and added comments. Just for organizational reasons more than anything.
// properly decorate the subscriber with `__syncError`. | ||
subscriber.add(operator.call(subscriber, this.source)); | ||
} else { | ||
try { |
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 primary "fix" is here for the cases where teardown wasn't being called after it was registered if a sync error was thrown.
subscriber.add(callback); | ||
// TODO: This try/finally was only added for `useDeprecatedSynchronousErrorHandling`. | ||
// REMOVE THIS WHEN THAT HOT GARBAGE IS REMOVED IN V8. | ||
try { |
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 "fix" for the finalize issue in the sync case is here. Note that adding a callback to a closed
subscriber will cause it to be executed immediately.
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.
🤢
Do we have tests that are the equivalent of these but are for the normal error handling - not the deprecated synchronous error handling? Seems like something worth testing if we're not already doing that. |
@cartant I'm unsure. I'll have a look after I merge this. |
Adds tests and ensures a few more scenarios that were hit in Google because they use the deprecated synchronous error handling.
fixes #6250
cc @leggechr