question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Animation modules break correctly disposing of the application

See original GitHub issue

🐞 bug report

Importing any animation module prevents the automatic removal of the generated elements from the DOM once the application has been destroyed via componentRef.destroy().

Affected Package

It looks like both BrowserAnimationsModule and NoopAnimationsModule from @angular/platform-browser/animations are causing the issue. When they’re not imported, everything seems fine.

Is this a regression?

Not sure. It’s a problem since at least Angular 7.

Description

I have an application that needs to be fired and stopped “on demand” (specifically, it’s a micro-frontend). In order to do so I implemented the ngDoBootstrap method as follow:

export class AppModule implements DoBootstrap {
  constructor(private service: AppService) {}

  ngDoBootstrap(app: ApplicationRef) {
    window.startApplication = () => {
      this.service.componentRef = app.bootstrap(AppComponent);
    };
  }
}

Here, AppService is just an @Injectable class with the sole public property componentRef, in order to make it available to the components. And in one component I have some logic that leads to this.service.componentRef.destroy() at the end of the lifecycle of the micro-frontend application. The application basically disposes itself.

When I import either BrowserAnimationsModule or NoopAnimationsModule in AppModule, the application seems to be destroyed but the corresponding DOM tree isn’t removed from the page.

🔬 Minimal Reproduction

Minimal StackBlitz reproduction.

🌍 Your Environment

Angular Version:


@angular-devkit/architect       0.1001.2
@angular-devkit/build-angular   0.1001.2
@angular-devkit/core            10.1.2
@angular-devkit/schematics      10.1.2
@schematics/angular             10.1.2
@schematics/update              0.1001.2
rxjs                            6.6.3
typescript                      4.0.3

Also verified with this configuration:


@angular-devkit/architect         0.13.9
@angular-devkit/build-angular     0.13.9
@angular-devkit/build-optimizer   0.13.9
@angular-devkit/build-webpack     0.13.9
@angular-devkit/core              7.3.9
@angular-devkit/schematics        7.3.9
@angular/cli                      7.3.9
@ngtools/webpack                  7.3.9
@schematics/angular               7.3.9
@schematics/update                0.13.9
rxjs                              6.5.2
typescript                        3.2.4
webpack                           4.29.0

Anything else relevant?

Checked in Chrome 85, Firefox 82, Safari 13.1.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
atscottcommented, Feb 10, 2022

Closing as the reproduction now demonstrates correct behavior in v13. Likely resolved by https://github.com/angular/angular/commit/c49b28013a6c017c9afc73bbc00bb4fdcf15c70e

1reaction
HimanshiDomircommented, Nov 29, 2021

Hi @petebacondarwin, we are having the similar issue while implementing micro frontend with multiple repos. we are using prime ng components. When we try to open any component of p-multiselect, which when opened leads to animation error as mentioned below. “Found the synthetic listener @overlayAnimation.start. Please include either “BrowserAnimationsModule” or “NoopAnimationsModule” in your application.”

Though we have already imported BrowserAnimationsModule in shell.

Could you please help us on this . . image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dispose widget when navigating to new route - Stack Overflow
When I use Navigator.pushNamed , Screen A remains in memory, and dispose() is not called, even though Screen B is now shown.
Read more >
Freeform Animation : Modular Rigging - Unity Forum
Use "Rig Modules" to label and retarget certain groups (and apply certain kinds of procedural animation) based on each module TYPE, letting ...
Read more >
Arena Basics - ResearchGate
The working simulation tool for the models in this book is Arena. Arena is a simulation environment consisting of module templates, built around...
Read more >
Slow rendering - Android Developers
If your app suffers from slow UI rendering, then the system is forced to skip frames and the user will perceive stuttering in...
Read more >
Matplotlib Animation Tutorial - Pythonic Perambulations
First we'll use FuncAnimation to do a basic animation of a sine wave moving across the screen: Basic Animation basic_animation.py download.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found