Skip to content

Commit

Permalink
Revert "fix(platform-browser): wait until animation completion before…
Browse files Browse the repository at this point in the history
… destroying renderer (#50677)" (#50857)

This reverts commit 2b55103.

PR Close #50857
  • Loading branch information
AndrewKushnir committed Jun 26, 2023
1 parent ed8b088 commit 452a3e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,4 @@ export class AnimationEngine {
whenRenderingDone(): Promise<any> {
return this._transitionEngine.whenRenderingDone();
}

afterFlushAnimationsDone(cb: VoidFunction): void {
this._transitionEngine.afterFlushAnimationsDone(cb);
}
}
15 changes: 5 additions & 10 deletions packages/platform-browser/animations/src/animation_renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,19 @@ export class AnimationRendererFactory implements RendererFactory2 {
export class BaseAnimationRenderer implements Renderer2 {
constructor(
protected namespaceId: string, public delegate: Renderer2, public engine: AnimationEngine,
private _onDestroy?: () => void) {}
private _onDestroy?: () => void) {
this.destroyNode = this.delegate.destroyNode ? (n) => delegate.destroyNode!(n) : null;
}

get data() {
return this.delegate.data;
}

destroyNode(node: any): void {
this.delegate.destroyNode?.(node);
}
destroyNode: ((n: any) => void)|null;

destroy(): void {
this.engine.destroy(this.namespaceId, this.delegate);
this.engine.afterFlushAnimationsDone(() => {
// Call the renderer destroy method after the animations has finished as otherwise styles will
// be removed too early which will cause an unstyled animation.
this.delegate.destroy();
});

this.delegate.destroy();
this._onDestroy?.();
}

Expand Down

0 comments on commit 452a3e9

Please sign in to comment.