Skip to content

Conversation

@crisbeto
Copy link
Member

When we create the LView for a component, we track it in the TRACKED_LVIEWS map. It gets untracked when it is destroy, but if it throws during creation, the user won't have access to a ComponentRef in order to clean it up.

These changes automatically untrack the related LViews if the component couldn't be created.

There's a second commit that fixes up some leaks in our own tests that I found while debugging.

@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Aug 27, 2024
@angular-robot angular-robot bot added the area: core Issues related to the framework runtime label Aug 27, 2024
@ngbot ngbot bot added this to the Backlog milestone Aug 27, 2024
@crisbeto crisbeto marked this pull request as ready for review August 27, 2024 10:39
When we create the LView for a component, we track it in the `TRACKED_LVIEWS` map. It gets untracked when it is destroy, but if it throws during creation, the user won't have access to a `ComponentRef` in order to clean it up.

These changes automatically untrack the related LViews if the component couldn't be created.
We had some tests that were leaking LViews, because we were testing things like `createComponent`, but not destroying them afterwards. These changes clean up most of them, although there are a handful still left that I didn't have time to fully track down.
@crisbeto
Copy link
Member Author

Feedback has been addressed.

@crisbeto crisbeto 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 Aug 27, 2024
@alxhub
Copy link
Member

alxhub commented Aug 27, 2024

This PR was merged into the repository by commit 96b698c.

The changes were merged into the following branches: main, 18.2.x

alxhub pushed a commit that referenced this pull request Aug 27, 2024
…57546)

When we create the LView for a component, we track it in the `TRACKED_LVIEWS` map. It gets untracked when it is destroy, but if it throws during creation, the user won't have access to a `ComponentRef` in order to clean it up.

These changes automatically untrack the related LViews if the component couldn't be created.

PR Close #57546
alxhub pushed a commit that referenced this pull request Aug 27, 2024
We had some tests that were leaking LViews, because we were testing things like `createComponent`, but not destroying them afterwards. These changes clean up most of them, although there are a handful still left that I didn't have time to fully track down.

PR Close #57546
@alxhub alxhub closed this in a3cdbfe Aug 27, 2024
alxhub pushed a commit that referenced this pull request Aug 27, 2024
We had some tests that were leaking LViews, because we were testing things like `createComponent`, but not destroying them afterwards. These changes clean up most of them, although there are a handful still left that I didn't have time to fully track down.

PR Close #57546
@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 27, 2024
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 area: core Issues related to the framework runtime target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants