-
Notifications
You must be signed in to change notification settings - Fork 156
Description
Description
We have an issue in igx-data grid outside of our internal production code.
We are using the data grid and run sometimes in an issue crashing the whole grid.
ERROR TypeError: Cannot read properties of undefined (reading 'index')
at _IgxTextHighlightDirective.activateIfNecessary (infragistics-igniteui-angular.mjs:37326:15)
at _IgxTextHighlightDirective.ngAfterViewChecked (infragistics-igniteui-angular.mjs:37284:12)
at callHookInternal (core.mjs:4165:10)
at callHook (core.mjs:4192:5)
at callHooks (core.mjs:4149:9)
at executeCheckHooks (core.mjs:4086:3)
at refreshView (core.mjs:14502:11)
at detectChangesInView (core.mjs:14643:5)
at detectChangesInViewIfAttached (core.mjs:14605:3)
at detectChangesInEmbeddedViews (core.mjs:14565:7)
- igniteui-angular version: 19.0.6
- browser: any
Steps to reproduce
Currently we can not precisely reproduce the issue. It might be related to us using "Ctrl" + click on row to execute an action. I'm sorry that I can not provide a more precise analysis how to reproduce but after reviewing the section in question it is a simple and reasonable fix.
Expected result
no issue
Analysis of issue
After checking the code it question there is a get method on a map. The returned value is not checked against undefined. The issue can be simply fixed by improving the if to check against undefined as well.
Function in question activateIfNecessary in directive IgxTextHighlightDirective after a get a check against undefined is missing
const group = this.service.highlightGroupsMap.get(this.groupName);
if (group.index >= 0 && group.column === this.column && group.row === this.row && compareMaps(this.metadata, group.metadata)) {
this.activate(group.index);
}
Statement
The section in question causes an issue. You are using a get method and not properly checking against undefined. The occurrence of the bug proves that this is causing an issue and should be fixed.