-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(grid): optimize grid row selection flow and performance - master #14610
Conversation
projects/igniteui-angular/src/lib/grids/selection/selection.service.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/src/lib/grids/selection/selection.service.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/src/lib/grids/selection/selection.service.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/src/lib/grids/selection/selection.service.ts
Outdated
Show resolved
Hide resolved
const unSelectedRows = allData.filter(row => !selectedData.has(row)); | ||
return this.allRowsSelected = this.allData.length > 0 && unSelectedRows.length === 0; | ||
allData = allData || this.allData; | ||
const selectedData = new Set(newSelection ? newSelection.map(r => this.getRecordKey(r)) : [...this.rowSelection]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is basically the same as
const selectedData = this.getRowIDs(newSelection || this.rowSelection);
So, maybe is better to use the abstracted getRowIDs
:
- better use it, thats why it is exposed at all
- makes reading code better
- makes less diff, so easier to review PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When #14610 (comment) gets resolved, it will not be needed at all to do mapping over newSelection
again. Still, verify that assumption.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose to use this approach: keep the newSelection
in its original format until after the rowSelectionChanging
event is emitted. This way, the selection data remains consistent throughout the event lifecycle, allowing the handler to correctly manipulate it as needed. This approach ensures proper functionality without any test failures.
Closes #14519
Additional information (check all that apply):
Checklist:
feature/README.MD
updates for the feature docsREADME.MD
CHANGELOG.MD
updates for newly added functionalityng update
migrations for the breaking changes (migrations guidelines)