Skip to content
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

Merged
merged 22 commits into from
Sep 30, 2024

Conversation

georgianastasov
Copy link
Contributor

Closes #14519

Additional information (check all that apply):

  • Bug fix
  • New functionality
  • Documentation
  • Demos
  • CI/CD

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them

@georgianastasov georgianastasov changed the title feat(grid): optimize grid row selection flow and performance feat(grid): optimize grid row selection flow and performance - master Aug 1, 2024
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]);
Copy link
Contributor

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:

  1. better use it, thats why it is exposed at all
  2. makes reading code better
  3. makes less diff, so easier to review PR

Copy link
Contributor

@hanastasov hanastasov Sep 19, 2024

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.

Copy link
Contributor Author

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.

@Zneeky Zneeky added 💥 status: in-test PRs currently being tested ✅ status: verified Applies to PRs that have passed manual verification and removed ❌ status: awaiting-test PRs awaiting manual verification 💥 status: in-test PRs currently being tested labels Sep 30, 2024
@kacheshmarova kacheshmarova merged commit 096f47c into master Sep 30, 2024
5 checks passed
@kacheshmarova kacheshmarova deleted the ganastasov/feat-14519-master branch September 30, 2024 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grid: performance grid: selection grid ✅ status: verified Applies to PRs that have passed manual verification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Grid row selection flow improvement
5 participants