Skip to content

Conversation

@thePunderWoman
Copy link
Contributor

@thePunderWoman thePunderWoman commented Aug 22, 2025

When @for loops added and removed an element in the same change detection cycle, the duplicate node prevention would cause the leaving node animation to be cancelled. This fix prevents cancellation of leave animations in @for loops. It also fixes a memory leak where nodes weren't properly getting cleaned up from the leaving nodes map.

Does this PR introduce a breaking change?

  • Yes
  • No

This ensures the nodes are properly cleaned up from the leaving nodes map.
@thePunderWoman thePunderWoman added action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime target: patch This PR is targeted for the next patch release labels Aug 22, 2025
@ngbot ngbot bot modified the milestone: Backlog Aug 22, 2025
@thePunderWoman thePunderWoman changed the title fix(core): fix memory leak with leaving nodes tracking fix(core): fix animation behavior on @for loops Aug 22, 2025
@thePunderWoman thePunderWoman force-pushed the for-animate-bug branch 3 times, most recently from da144b2 to 96dd7a9 Compare August 22, 2025 12:02
There's special logic in place to prevent duplicate nodes from showing up in the case when an `@if` toggles a view quickly. This had the unfortunate side effect of causing `@for` leave animations to get cancelled when an add and remove happened simultaneously, even if it was a different index. This fix prevents that from happening in the `@for` loop case.

fixes: angular#63307
@thePunderWoman thePunderWoman 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 22, 2025
@AndrewKushnir
Copy link
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

AndrewKushnir pushed a commit that referenced this pull request Aug 22, 2025
This ensures the nodes are properly cleaned up from the leaving nodes map.

PR Close #63328
AndrewKushnir pushed a commit that referenced this pull request Aug 22, 2025
There's special logic in place to prevent duplicate nodes from showing up in the case when an `@if` toggles a view quickly. This had the unfortunate side effect of causing `@for` leave animations to get cancelled when an add and remove happened simultaneously, even if it was a different index. This fix prevents that from happening in the `@for` loop case.

fixes: #63307

PR Close #63328
AndrewKushnir pushed a commit that referenced this pull request Aug 22, 2025
There's special logic in place to prevent duplicate nodes from showing up in the case when an `@if` toggles a view quickly. This had the unfortunate side effect of causing `@for` leave animations to get cancelled when an add and remove happened simultaneously, even if it was a different index. This fix prevents that from happening in the `@for` loop case.

fixes: #63307

PR Close #63328
@thePunderWoman thePunderWoman deleted the for-animate-bug branch September 12, 2025 16:37
@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 Oct 13, 2025
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.

5 participants