Skip to content

Commit

Permalink
perf(module:tabs): do not run change detection when the promise resol…
Browse files Browse the repository at this point in the history
…ves (#7144)
  • Loading branch information
arturovt authored Feb 22, 2022
1 parent b72bd27 commit 148f84d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions components/tabs/tabset.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
ContentChildren,
EventEmitter,
Input,
NgZone,
OnDestroy,
OnInit,
Optional,
Expand Down Expand Up @@ -234,6 +235,7 @@ export class NzTabSetComponent implements OnInit, AfterContentChecked, OnDestroy

constructor(
public nzConfigService: NzConfigService,
private ngZone: NgZone,
private cdr: ChangeDetectorRef,
@Optional() private directionality: Directionality,
@Optional() private router: Router
Expand All @@ -259,9 +261,10 @@ export class NzTabSetComponent implements OnInit, AfterContentChecked, OnDestroy
}

ngAfterContentInit(): void {
Promise.resolve().then(() => {
this.setUpRouter();
this.ngZone.runOutsideAngular(() => {
Promise.resolve().then(() => this.setUpRouter());
});

this.subscribeToTabLabels();
this.subscribeToAllTabChanges();

Expand Down

0 comments on commit 148f84d

Please sign in to comment.