Skip to content

Commit 452a3e9

Browse files
committed
Revert "fix(platform-browser): wait until animation completion before destroying renderer (#50677)" (#50857)
This reverts commit 2b55103. PR Close #50857
1 parent ed8b088 commit 452a3e9

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

packages/animations/browser/src/render/animation_engine_next.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,4 @@ export class AnimationEngine {
113113
whenRenderingDone(): Promise<any> {
114114
return this._transitionEngine.whenRenderingDone();
115115
}
116-
117-
afterFlushAnimationsDone(cb: VoidFunction): void {
118-
this._transitionEngine.afterFlushAnimationsDone(cb);
119-
}
120116
}

packages/platform-browser/animations/src/animation_renderer.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,24 +138,19 @@ export class AnimationRendererFactory implements RendererFactory2 {
138138
export class BaseAnimationRenderer implements Renderer2 {
139139
constructor(
140140
protected namespaceId: string, public delegate: Renderer2, public engine: AnimationEngine,
141-
private _onDestroy?: () => void) {}
141+
private _onDestroy?: () => void) {
142+
this.destroyNode = this.delegate.destroyNode ? (n) => delegate.destroyNode!(n) : null;
143+
}
142144

143145
get data() {
144146
return this.delegate.data;
145147
}
146148

147-
destroyNode(node: any): void {
148-
this.delegate.destroyNode?.(node);
149-
}
149+
destroyNode: ((n: any) => void)|null;
150150

151151
destroy(): void {
152152
this.engine.destroy(this.namespaceId, this.delegate);
153-
this.engine.afterFlushAnimationsDone(() => {
154-
// Call the renderer destroy method after the animations has finished as otherwise styles will
155-
// be removed too early which will cause an unstyled animation.
156-
this.delegate.destroy();
157-
});
158-
153+
this.delegate.destroy();
159154
this._onDestroy?.();
160155
}
161156

0 commit comments

Comments
 (0)