You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Two elements appear when leave animation is running and @if is toggled true #63020
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
No
Description
In the case where you use an animate.enter and an animate.leave with a longer animation time you can see a duplicated element in the case that you toggle the @if to true while the leave animation is running. While this is expected, ideally we should not see duplicated elements.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run ng version)
The biggest challenge here is that while the leave animation is running, the element is technically destroyed and Angular only can create a new element at this point. Ideally we could cancel / complete the running animations and remove the node right away in this situation, but we'd have to know which element to remove.
Well in native css world with :starting-style and :exit-style I would expect to see duplicated elements as well, so mayby it's not unexpected at all?
Another way I see it, would be to reuse dom node that are sheduled to be destroyed afrer animation ends? But that would probably lead to changes in ivy?
@kbrilla yeah, that's totally expected, but it's just not ideal. We definitely wouldn't re-use the DOM node at this point. We should be able to identify the exiting DOM node though and be able to remove it immediately in the case that an enter is about to happen.
Activity
thePunderWoman commentedon Aug 6, 2025
The biggest challenge here is that while the leave animation is running, the element is technically destroyed and Angular only can create a new element at this point. Ideally we could cancel / complete the running animations and remove the node right away in this situation, but we'd have to know which element to remove.
kbrilla commentedon Aug 6, 2025
Well in
native cssworld with:starting-styleand:exit-styleI would expect to see duplicated elements as well, so mayby it's not unexpected at all?Another way I see it, would be to reuse dom node that are sheduled to be destroyed afrer animation ends? But that would probably lead to changes in
ivy?thePunderWoman commentedon Aug 6, 2025
@kbrilla yeah, that's totally expected, but it's just not ideal. We definitely wouldn't re-use the DOM node at this point. We should be able to identify the exiting DOM node though and be able to remove it immediately in the case that an enter is about to happen.
fix(core): prevents duplicate nodes when `@if` toggles with leave ani…
fix(core): prevents duplicate nodes when `@if` toggles with leave ani…
fix(core): prevents duplicate nodes when `@if` toggles with leave ani…
fix(core): prevents duplicate nodes when `@if` toggles with leave ani…
fix(core): prevents duplicate nodes when `@if` toggles with leave ani…
fix(core): prevents duplicate nodes when `@if` toggles with leave ani…
angular-automatic-lock-bot commentedon Sep 8, 2025
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.