Skip to content

Commit

Permalink
fix(module:table): memory leak (#6325)
Browse files Browse the repository at this point in the history
  • Loading branch information
olivewind authored Jan 13, 2021
1 parent 7908014 commit 7f267b6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions components/table/src/table/tr.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ export class NzTrDirective implements AfterContentInit, OnDestroy {
listOfFixedRight.forEach(cell => cell.setIsFirstRight(cell === listOfFixedRight[0]));
});
/** calculate fixed nzLeft and nzRight **/
combineLatest([this.nzTableStyleService.listOfListOfThWidth$, this.listOfFixedLeftColumnChanges$]).subscribe(
([listOfAutoWidth, listOfLeftCell]) => {
combineLatest([this.nzTableStyleService.listOfListOfThWidth$, this.listOfFixedLeftColumnChanges$])
.pipe(takeUntil(this.destroy$))
.subscribe(([listOfAutoWidth, listOfLeftCell]) => {
listOfLeftCell.forEach((cell, index) => {
if (cell.isAutoLeft) {
const currentArray = listOfLeftCell.slice(0, index);
Expand All @@ -68,10 +69,10 @@ export class NzTrDirective implements AfterContentInit, OnDestroy {
cell.setAutoLeftWidth(`${width}px`);
}
});
}
);
combineLatest([this.nzTableStyleService.listOfListOfThWidth$, this.listOfFixedRightColumnChanges$]).subscribe(
([listOfAutoWidth, listOfRightCell]) => {
});
combineLatest([this.nzTableStyleService.listOfListOfThWidth$, this.listOfFixedRightColumnChanges$])
.pipe(takeUntil(this.destroy$))
.subscribe(([listOfAutoWidth, listOfRightCell]) => {
listOfRightCell.forEach((_, index) => {
const cell = listOfRightCell[listOfRightCell.length - index - 1];
if (cell.isAutoRight) {
Expand All @@ -83,8 +84,7 @@ export class NzTrDirective implements AfterContentInit, OnDestroy {
cell.setAutoRightWidth(`${width}px`);
}
});
}
);
});
}
}

Expand Down

0 comments on commit 7f267b6

Please sign in to comment.