Skip to content

Commit

Permalink
fix(demo): small leak fix when leaving the page
Browse files Browse the repository at this point in the history
- the `removeCellStyling` is on a `setTimeout` which might be executed after leaving the page, so just make sure the grid object is still available before executing this code
  • Loading branch information
ghiscoding committed Jan 17, 2022
1 parent 618a0e2 commit b488757
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app/examples/grid-trading.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,14 @@ export class GridTradingComponent implements OnDestroy, OnInit {
this.angularGrid.slickGrid.setCellCssStyles(`highlight_${[column.id]}${row}`, hash);

// remove highlight after x amount of time
setTimeout(() => this.removeUnsavedStylingFromCell(item, column, row), this.highlightDuration);
setTimeout(() => this.removeCellStyling(item, column, row), this.highlightDuration);
}
}
}

/** remove change highlight css class from that cell */
removeUnsavedStylingFromCell(_item: any, column: Column, row: number) {
this.angularGrid.slickGrid.removeCellCssStyles(`highlight_${[column.id]}${row}`);
removeCellStyling(_item: any, column: Column, row: number) {
this.angularGrid?.slickGrid?.removeCellCssStyles(`highlight_${[column.id]}${row}`);
}

toggleFullScreen() {
Expand Down

0 comments on commit b488757

Please sign in to comment.