Skip to content

Commit 4cf711f

Browse files
committed
chore(grid): apply review notes
1 parent a20054f commit 4cf711f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

projects/igniteui-angular/src/lib/grids/cell.component.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,24 +211,24 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy, CellT
211211
* @memberof IgxGridCellComponent
212212
*/
213213
public get context(): IgxCellTemplateContext {
214+
const getCellType = () => this.getCellType(true);
214215
const ctx = {
215216
$implicit: this.value,
216217
additionalTemplateContext: this.column.additionalTemplateContext,
217-
cell: this
218+
get cell() {
219+
/* Turns the `cell` property from the template context object into lazy-evaluated one.
220+
* Otherwise on each detection cycle the cell template is recreating N cell instances where
221+
* N = number of visible cells in the grid, leading to massive performance degradation in large grids.
222+
*/
223+
return getCellType();
224+
}
218225
};
219226
if (this.editMode) {
220227
ctx['formControl'] = this.formControl;
221228
}
222229
if (this.isInvalid) {
223230
ctx['defaultErrorTemplate'] = this.defaultErrorTemplate;
224231
}
225-
/* Turns the `cell` property from the template context object into lazy-evaluated one.
226-
* Otherwise on each detection cycle the cell template is recreating N cell instances where
227-
* N = number of visible cells in the grid, leading to massive performance degradation in large grids.
228-
*/
229-
Object.defineProperty(ctx, 'cell', {
230-
get: () => this.getCellType(true)
231-
});
232232
return ctx;
233233
}
234234

0 commit comments

Comments
 (0)