fix(platform-browser): clear renderer cache during HMR when using async animations (#59644)

Fixes that the async animations renderer didn't have the logic to clean up its style cache during HMR. This is identical to #59393.

Fixes #59640.

PR Close #59644
This commit is contained in:
Kristiyan Kostadinov
2025-01-21 10:51:55 +01:00
committed by Andrew Kushnir
parent ea2346955c
commit 65f51e16aa
@@ -167,6 +167,16 @@ export class AsyncAnimationRendererFactory implements OnDestroy, RendererFactory
whenRenderingDone?(): Promise<any> {
return this.delegate.whenRenderingDone?.() ?? Promise.resolve();
}
/**
* Used during HMR to clear any cached data about a component.
* @param componentId ID of the component that is being replaced.
*/
protected componentReplaced(componentId: string) {
// Flush the engine since the renderer destruction waits for animations to be done.
this._engine?.flush();
(this.delegate as {componentReplaced?: (id: string) => void}).componentReplaced?.(componentId);
}
}
/**