Skip to content

fix(material/expansion): not clearing custom query list #21222

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

Merged
merged 1 commit into from
Dec 8, 2020

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Dec 4, 2020

MatAccordion has a custom QueryList for keeping track of its own headers which we weren't destroying. These changes add a call to destroy it since it has the potential of leaking memory.

`MatAccordion` has a custom `QueryList` for keeping track of its own headers which we weren't
destroying. These changes add a call to destroy it since it has the potential of leaking memory.
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Dec 4, 2020
@crisbeto crisbeto requested a review from jelbourn as a code owner December 4, 2020 21:14
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 4, 2020
wagnermaciel
wagnermaciel previously approved these changes Dec 4, 2020
Copy link
Contributor

@wagnermaciel wagnermaciel left a comment

Choose a reason for hiding this comment

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

LGTM

@wagnermaciel
Copy link
Contributor

wagnermaciel commented Dec 4, 2020

@crisbeto @jelbourn This looks LGTM, but doesn't QueryList already get called when the component is destroyed?
https://github.com/angular/angular/blob/master/packages/core/src/view/view.ts#L547

The docs for QueryList.destroy() just say "internal", which seems to imply that we aren't meant to call this.
https://angular.io/api/core/QueryList#destroy

@wagnermaciel wagnermaciel self-requested a review December 4, 2020 22:24
@wagnermaciel wagnermaciel dismissed their stale review December 4, 2020 22:27

I'd like to understand why we need to call QueryList.destroy() first, since it should be handled internally.

@crisbeto
Copy link
Member Author

crisbeto commented Dec 4, 2020

destroy won't be called for this QueryList in particular, because we construct it manually. Only the ones constructed by the framework are cleaned up automatically.

Copy link
Contributor

@wagnermaciel wagnermaciel left a comment

Choose a reason for hiding this comment

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

LGTM again

@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Dec 5, 2020
@wagnermaciel wagnermaciel merged commit 2076686 into angular:master Dec 8, 2020
wagnermaciel pushed a commit that referenced this pull request Dec 8, 2020
`MatAccordion` has a custom `QueryList` for keeping track of its own headers which we weren't
destroying. These changes add a call to destroy it since it has the potential of leaking memory.

(cherry picked from commit 2076686)
@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 Jan 8, 2021
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 PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants