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(zone.js): patch child method that overrides an already patched method #39850
Conversation
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.
@edusperoni , please write some details information to describe,
- What is the issue?
- How this PR resolve it?
And also please make lint
task pass, please also add the issue and how this PR resolve the issue in the commit message.
Finally please squash the two commits.
Thanks.
@JiaLiPassion I've added more information in the description. Is this enough? You want me to add that information in the commit as well, correct? Edit: Also, yarn lint is not outputting any errors on my code, can you clarify the issue? |
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.
LGTM, thanks.
And the lint is failing because the commit messages are not correct.
Please add the description you added in this PR to the commit message, and following the rule described here.
https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format
8bbab0d
to
82926a7
Compare
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.
reviewed-for: global-approvers
…thod Fix a case where, if the parent class had already been patched, it would not patch the child class. In addition to checking if the method is defined in the prototype, and not inherited, it also does the same for the unpatched method.
82926a7
to
aac8b03
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
When running
patchMethod
on a target that had it's parent already patched, the patch would not be applied.Consider we have these 3 classes:
As we can see,
OverrideType
overridesmethod
, so we want to patch it as well as patchingType
. I've added the helper function patchType.Issue Number: N/A
What is the new behavior?
patchMethod
correctly patches a class that overrides a parent method. It now verifies if the__symbol__(delegateName)
is defined in the prototype and not just inherited, resulting in the following behavior:Does this PR introduce a breaking change?
Other information
This issue arose while providing patches to the NativeScript framework, which has an
Observable
class which emits events.View
, which inheritsObservable
, overridesaddEventListener
and provides it's own implementation to emit gesture events, as it needs to keep track of how many observers there are to remove the listeners when there are none.