Skip to content

(animate.leave) is broken again inside @for loop? #64336

@ahimik

Description

@ahimik

Which @angular/* package(s) are the source of the bug?

animations

Is this a regression?

Yes

Description

Some time ago this issue was fixed, and everything worked correctly in my app using Angular version 20.2.2.

Recently, I discovered another bug and decided to upgrade to the latest Angular version (20.3.5). Thankfully, that bug was fixed — but now all animations that use the (animate.leave) callback inside an @for loop are broken again.

I tried to create a minimal reproduction. Here is working 20.2.2 version:
https://stackblitz.com/edit/stackblitz-starters-sjmv75g1?file=src%2Fmain.ts

and here is non-working 20.3.4 version of absolutely the same code:

https://stackblitz.com/edit/stackblitz-starters-ztd64b7s?file=package.json

Am I doing something wrong here?

Please also note that using the animate.leave class binding works fine — the issue only occurs when using the callback syntax.

@thePunderWoman, could you please take a quick look into this since you worken on this issue? Thank you.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-ztd64b7s?file=package.json

Please provide the exception or error you saw

(animate.leave) callback get fired, but the element is immediately removed from DOM

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 20.3.5
Node: 22.12.0
Package Manager: npm 10.9.0
OS: win32 x64
    

Angular: 20.3.4
... common, compiler, compiler-cli, core, forms, localize
... platform-browser, router

Package                      Version
------------------------------------
@angular-devkit/architect    0.2003.5
@angular-devkit/core         20.3.5 (cli-only)
@angular-devkit/schematics   20.3.5
@angular/build               20.3.5
@angular/cdk                 20.2.8
@angular/cli                 20.3.5
@angular/material            20.2.8
@schematics/angular          20.3.5
rxjs                         7.8.2

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtimecore: animationsIssues related to `animate.enter` and `animate.leave`state: has PR

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions