Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(animations): cleanup DOM elements when the root view is removed #41059

Closed
wants to merge 1 commit into from

Commits on Mar 18, 2021

  1. fix(animations): cleanup DOM elements when the root view is removed

    Currently, when importing `BrowserAnimationsModule`, 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.
    
    BREAKING CHANGE:
    DOM elements are now correctly removed when the root view is removed.
    If you are using SSR and use the app's HTML for rendering, you will need
    to ensure that you save the HTML to a variable before destorying the
    app.
    It is also possible that tests could be accidentally relying on the old behavior by
    trying to find an element that was not removed in a previous test. If
    this is the case, the failing tests should be updated to ensure they
    have proper setup code which initializes elements they rely on.
    arturovt authored and atscott committed Mar 18, 2021
    Configuration menu
    Copy the full SHA
    07b843d View commit details
    Browse the repository at this point in the history