Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b2b3816

Browse files
crisbetoAndrewKushnir
authored andcommitted
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
1 parent 408af24 commit b2b3816

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎packages/platform-browser/animations/async/src/async_animation_renderer.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,16 @@ export class AsyncAnimationRendererFactory implements OnDestroy, RendererFactory
167167
whenRenderingDone?(): Promise<any> {
168168
return this.delegate.whenRenderingDone?.() ?? Promise.resolve();
169169
}
170+
171+
/**
172+
* Used during HMR to clear any cached data about a component.
173+
* @param componentId ID of the component that is being replaced.
174+
*/
175+
protected componentReplaced(componentId: string) {
176+
// Flush the engine since the renderer destruction waits for animations to be done.
177+
this._engine?.flush();
178+
(this.delegate as {componentReplaced?: (id: string) => void}).componentReplaced?.(componentId);
179+
}
170180
}
171181

172182
/**

0 commit comments

Comments
 (0)