Skip to content

fix(animations): cleanup DOM elements when root view is removed with async animations - #53033

Closed
arturovt wants to merge 1 commit into
angular:mainfrom
arturovt:fix/async-animations-cleanup
Closed

arturovt wants to merge 1 commit into
angular:mainfrom
arturovt:fix/async-animations-cleanup

Conversation

@arturovt

@arturovt arturovt commented Nov 18, 2023 •

Copy link
Copy Markdown
Contributor

Currently, when using provideAnimationsAsync, Angular uses AnimationRenderer as the renderer. When the root view is removed, the AnimationRenderer defers the actual work to the TransitionAnimationEngine to do this, and the TransitionAnimationEngine doesn't actually remove the DOM node, but just calls markElementAsRemoved().

The actual DOM node is not removed until TransitionAnimationEngine "flushes".

Unfortunately, though, that "flush" will never happen, since the root view is being destroyed and there will be no more flushes.

This commit adds flush() call when the root view is being destroyed.


Current behavior:

Screencast.from.01-25-2024.03.23.11.PM.webm

@pullapprove
pullapprove Bot requested a review from crisbeto November 18, 2023 23:08
@crisbeto
crisbeto requested a review from JeanMeche November 19, 2023 07:07
@arturovt
arturovt force-pushed the fix/async-animations-cleanup branch from aa42aba to 5e00b02 Compare November 19, 2023 09:40
@pkozlowski-opensource pkozlowski-opensource added the area: animations legacy animations package only. Otherwise use area: core. label Nov 27, 2023
@ngbot ngbot Bot added this to the Backlog milestone Nov 27, 2023
…async animations

Currently, when using `provideAnimationsAsync`, Angular uses `AnimationRenderer`
as the renderer. When the root view is removed, the `AnimationRenderer` defers the actual
work to the `TransitionAnimationEngine` to do this, and the `TransitionAnimationEngine`
doesn't actually remove the DOM node, but just calls `markElementAsRemoved()`.

The actual DOM node is not removed until `TransitionAnimationEngine` "flushes".

Unfortunately, though, that "flush" will never happen, since the root view is being
destroyed and there will be no more flushes.

This commit adds `flush()` call when the root view is being destroyed.
@arturovt
arturovt force-pushed the fix/async-animations-cleanup branch from 5e00b02 to 63cd7d0 Compare January 25, 2024 13:25

@JeanMeche JeanMeche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@JeanMeche
JeanMeche requested review from jessicajaniuk and removed request for crisbeto January 25, 2024 13:47

@jessicajaniuk jessicajaniuk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@jessicajaniuk jessicajaniuk added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Jan 25, 2024
jessicajaniuk pushed a commit that referenced this pull request Jan 25, 2024
…async animations (#53033)

Currently, when using `provideAnimationsAsync`, Angular uses `AnimationRenderer`
as the renderer. When the root view is removed, the `AnimationRenderer` defers the actual
work to the `TransitionAnimationEngine` to do this, and the `TransitionAnimationEngine`
doesn't actually remove the DOM node, but just calls `markElementAsRemoved()`.

The actual DOM node is not removed until `TransitionAnimationEngine` "flushes".

Unfortunately, though, that "flush" will never happen, since the root view is being
destroyed and there will be no more flushes.

This commit adds `flush()` call when the root view is being destroyed.

PR Close #53033
@jessicajaniuk

Copy link
Copy Markdown
Contributor

This PR was merged into the repository by commit 75aeae4.

@arturovt
arturovt deleted the fix/async-animations-cleanup branch January 25, 2024 16:33
rlmestre pushed a commit to rlmestre/angular that referenced this pull request Jan 26, 2024
…async animations (angular#53033)

Currently, when using `provideAnimationsAsync`, Angular uses `AnimationRenderer`
as the renderer. When the root view is removed, the `AnimationRenderer` defers the actual
work to the `TransitionAnimationEngine` to do this, and the `TransitionAnimationEngine`
doesn't actually remove the DOM node, but just calls `markElementAsRemoved()`.

The actual DOM node is not removed until `TransitionAnimationEngine` "flushes".

Unfortunately, though, that "flush" will never happen, since the root view is being
destroyed and there will be no more flushes.

This commit adds `flush()` call when the root view is being destroyed.

PR Close angular#53033
amilamen pushed a commit to amilamen/angular that referenced this pull request Jan 26, 2024
…async animations (angular#53033)

Currently, when using `provideAnimationsAsync`, Angular uses `AnimationRenderer`
as the renderer. When the root view is removed, the `AnimationRenderer` defers the actual
work to the `TransitionAnimationEngine` to do this, and the `TransitionAnimationEngine`
doesn't actually remove the DOM node, but just calls `markElementAsRemoved()`.

The actual DOM node is not removed until `TransitionAnimationEngine` "flushes".

Unfortunately, though, that "flush" will never happen, since the root view is being
destroyed and there will be no more flushes.

This commit adds `flush()` call when the root view is being destroyed.

PR Close angular#53033
nikvarma pushed a commit to nikvarma/angular that referenced this pull request Jan 31, 2024
…async animations (angular#53033)

Currently, when using `provideAnimationsAsync`, Angular uses `AnimationRenderer`
as the renderer. When the root view is removed, the `AnimationRenderer` defers the actual
work to the `TransitionAnimationEngine` to do this, and the `TransitionAnimationEngine`
doesn't actually remove the DOM node, but just calls `markElementAsRemoved()`.

The actual DOM node is not removed until `TransitionAnimationEngine` "flushes".

Unfortunately, though, that "flush" will never happen, since the root view is being
destroyed and there will be no more flushes.

This commit adds `flush()` call when the root view is being destroyed.

PR Close angular#53033
@angular-automatic-lock-bot

Copy link
Copy Markdown

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 Feb 25, 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: animations legacy animations package only. Otherwise use area: core. target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants