File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -543,11 +543,18 @@ export class CdkVirtualScrollViewport extends CdkVirtualScrollable implements On
543543 // potential delays between the browser paint and the next tick.
544544 this . ngZone . runOutsideAngular ( async ( ) => {
545545 await Promise . resolve ( ) ;
546- if ( ! rendered && this . _runAfterChangeDetection . length > 0 ) {
547- this . ngZone . run ( ( ) => {
548- this . _applicationRef . tick ( ) ;
549- } ) ;
546+ if (
547+ rendered ||
548+ this . _runAfterChangeDetection . length === 0 ||
549+ // shouldn't be possible since we run this asynchronously and tick is synchronous, but ZoneJS/fakeAsync
550+ // can flush microtasks synchronously
551+ ( this . _applicationRef as unknown as { _runningTick : boolean } ) . _runningTick
552+ ) {
553+ return ;
550554 }
555+ this . ngZone . run ( ( ) => {
556+ this . _applicationRef . tick ( ) ;
557+ } ) ;
551558 } ) ;
552559 }
553560
You can’t perform that action at this time.
0 commit comments