Skip to content

fix(upgrade): correctly destroy nested downgraded component #22400

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

Closed
wants to merge 1 commit into from

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Feb 23, 2018

PR Checklist

PR Type

[x] Bugfix

What is the current behavior?

When a downgraded component is destroyed in a way that does not trigger the $destroy event on the element (e.g. when a parent element was removed from the DOM by Angular, not AngularJS), the ComponentRef is not destroyed and unregistered.

Issue Number: #22392

What is the new behavior?

Downgraded components are always correctly destroyed and unregistered.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Fixes #22392.

@gkalpak gkalpak added type: bug/fix action: review The PR is still awaiting reviews from at least one requested reviewer comp: upgrade/dynamic target: patch This PR is targeted for the next patch release labels Feb 23, 2018
@mary-poppins
Copy link

You can preview 78fe92e at https://pr22400-78fe92e.ngbuilds.io/.

adapter.registerCleanup();
expect(registry.getAllTestabilities().length).toEqual(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the reason for moving this line?

Copy link
Member Author

Choose a reason for hiding this comment

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

No reason 😁
I was trying something out and forgot to revert than part. I'll revert it.

Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

LGTM when Travis and CircleCI are happy.

@gkalpak gkalpak force-pushed the fix-upgrade-destroy-hook branch from 78fe92e to 048a4f5 Compare February 23, 2018 14:17
@mary-poppins
Copy link

You can preview 048a4f5 at https://pr22400-048a4f5.ngbuilds.io/.

@gkalpak gkalpak force-pushed the fix-upgrade-destroy-hook branch from 048a4f5 to 67c5427 Compare February 23, 2018 21:44
@mary-poppins
Copy link

You can preview 67c5427 at https://pr22400-67c5427.ngbuilds.io/.

@gkalpak gkalpak added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Feb 24, 2018
Previously, when a downgraded component was destroyed in a way that did
not trigger the `$destroy` event on the element (e.g. when a parent
element was removed from the DOM by Angular, not AngularJS), the
`ComponentRef` was not destroyed and unregistered.
This commit fixes it by listening for the `$destroy` event on both the
element and the scope.

Fixes angular#22392
@gkalpak gkalpak force-pushed the fix-upgrade-destroy-hook branch from 67c5427 to 2183d02 Compare February 27, 2018 16:26
@mary-poppins
Copy link

You can preview 2183d02 at https://pr22400-2183d02.ngbuilds.io/.

@IgorMinar IgorMinar added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Feb 27, 2018
@IgorMinar
Copy link
Contributor

Can the caretaker run a presubmit for this one please?

@alexeagle alexeagle closed this in 8a85888 Feb 28, 2018
alexeagle pushed a commit that referenced this pull request Feb 28, 2018
Previously, when a downgraded component was destroyed in a way that did
not trigger the `$destroy` event on the element (e.g. when a parent
element was removed from the DOM by Angular, not AngularJS), the
`ComponentRef` was not destroyed and unregistered.
This commit fixes it by listening for the `$destroy` event on both the
element and the scope.

Fixes #22392

PR Close #22400
@gkalpak gkalpak deleted the fix-upgrade-destroy-hook branch February 28, 2018 12:15
smdunn pushed a commit to smdunn/angular that referenced this pull request Feb 28, 2018
…22400)

Previously, when a downgraded component was destroyed in a way that did
not trigger the `$destroy` event on the element (e.g. when a parent
element was removed from the DOM by Angular, not AngularJS), the
`ComponentRef` was not destroyed and unregistered.
This commit fixes it by listening for the `$destroy` event on both the
element and the scope.

Fixes angular#22392

PR Close angular#22400
This was referenced Mar 15, 2018
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
…22400)

Previously, when a downgraded component was destroyed in a way that did
not trigger the `$destroy` event on the element (e.g. when a parent
element was removed from the DOM by Angular, not AngularJS), the
`ComponentRef` was not destroyed and unregistered.
This commit fixes it by listening for the `$destroy` event on both the
element and the scope.

Fixes angular#22392

PR Close angular#22400
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release type: bug/fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

downgraded components within upgraded are not destroyed
5 participants