mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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:
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user