@@ -25,7 +25,7 @@ import { ColumnType } from './common/column.interface';
2525import { RowType } from './common/row.interface' ;
2626import { GridSelectionMode } from './common/enums' ;
2727import { GridType } from './common/grid.interface' ;
28- import { getCurrencySymbol , getLocaleCurrencyCode } from '@angular/common' ;
28+ import { getCurrencySymbol , getLocaleCurrencyCode } from '@angular/common' ;
2929import { GridColumnDataType } from '../data-operations/data-util' ;
3030import { IgxRowDirective } from './row.directive' ;
3131import { ISearchInfo } from './common/events' ;
@@ -165,11 +165,18 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
165165 * @memberof IgxGridCellComponent
166166 */
167167 public get context ( ) : any {
168- return {
168+ const ctx = {
169169 $implicit : this . value ,
170- cell : this . getCellType ( ) ,
171- additionalTemplateContext : this . column . additionalTemplateContext
170+ additionalTemplateContext : this . column . additionalTemplateContext ,
172171 } ;
172+ /* Turns the `cell` property from the template context object into lazy-evaluated one.
173+ * Otherwise on each detection cycle the cell template is recreating N cell instances where
174+ * N = number of visible cells in the grid, leading to massive performance degradation in large grids.
175+ */
176+ Object . defineProperty ( ctx , 'cell' , {
177+ get : ( ) => this . getCellType ( )
178+ } ) ;
179+ return ctx ;
173180 }
174181
175182 /**
@@ -804,7 +811,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
804811 cell = this . grid . crudService . createCell ( this ) ;
805812 }
806813 cell . editValue = val ;
807- const args = this . gridAPI . update_cell ( cell ) ;
814+ this . gridAPI . update_cell ( cell ) ;
808815 this . grid . crudService . endCellEdit ( ) ;
809816 this . cdr . markForCheck ( ) ;
810817 }
@@ -831,7 +838,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
831838 }
832839 return ;
833840 }
834- if ( this . platformUtil . isFirefox ) {
841+ if ( this . platformUtil . isFirefox ) {
835842 event . preventDefault ( ) ;
836843 }
837844 this . selectionService . pointerDown ( this . selectionNode , event . shiftKey , event . ctrlKey ) ;
0 commit comments