fix(core): should check Zone existance when scheduleMicroTask (#20656)
PR Close #20656
This commit is contained in:

committed by
Alex Rickabaugh

parent
7b120b5f73
commit
3a86940ca5
@ -19,6 +19,7 @@ export class AnimationRendererFactory implements RendererFactory2 {
|
||||
private _animationCallbacksBuffer: [(e: any) => any, any][] = [];
|
||||
private _rendererCache = new Map<Renderer2, BaseAnimationRenderer>();
|
||||
private _cdRecurDepth = 0;
|
||||
private promise: Promise<any> = Promise.resolve(0);
|
||||
|
||||
constructor(
|
||||
private delegate: RendererFactory2, private engine: AnimationEngine, private _zone: NgZone) {
|
||||
@ -69,7 +70,8 @@ export class AnimationRendererFactory implements RendererFactory2 {
|
||||
}
|
||||
|
||||
private _scheduleCountTask() {
|
||||
Zone.current.scheduleMicroTask('incremenet the animation microtask', () => this._microtaskId++);
|
||||
// always use promise to schedule microtask instead of use Zone
|
||||
this.promise.then(() => { this._microtaskId++; });
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
|
Reference in New Issue
Block a user