perf(table): improve performance#14817
Draft
jcfranco wants to merge 2 commits into
Draft
Conversation
jcfranco
force-pushed
the
jcfranco/14766-improve-table-performance
branch
from
July 15, 2026 19:23
a806cbc to
92e6dd4
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR targets calcite-table performance by reducing repeated DOM queries and unnecessary per-row/per-cell updates, aligning with issue #14766’s goal of mitigating excessive work during table interactions (pagination, selection, focus navigation, and AT text updates).
Changes:
- Refactors table row bookkeeping to reuse cached visible row positions and split row refresh/state/localization responsibilities.
- Reduces selection-related work by batching row selection updates and deferring selection cell syncing/event emission where possible.
- Gates screen-reader text generation in
table-cell/table-headerto only run when those AT-only nodes are actually present/needed.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/components/src/components/table/table.tsx | Refactors row refresh/state/pagination flow; adds cached visible row positions and batches selection updates to reduce repeated work. |
| packages/components/src/components/table-row/table-row.tsx | Splits “refresh” vs “sync” cell updates; adds selection batching helpers to reduce repeated cell syncing/events. |
| packages/components/src/components/table-header/table-header.tsx | Avoids generating/updating screen reader text unless selection/number header cells are present. |
| packages/components/src/components/table-cell/table-cell.tsx | Avoids generating/updating screen reader text unless readCellContentsToAT/selection cell support is enabled; limits slotchange work. |
Comment on lines
+458
to
+461
| if (!row.itemHidden) { | ||
| lastVisibleBodyRow = row; | ||
| break; | ||
| } |
Comment on lines
+426
to
+449
| private updateVisibleRowPositions(): void { | ||
| this.firstVisibleBodyRowPosition = undefined; | ||
| this.lastVisibleBodyRowPosition = undefined; | ||
| this.lastVisibleTableRowPosition = undefined; | ||
| this.lastHeadRowPosition = this.headRows[this.headRows.length - 1]?.positionAll; | ||
|
|
||
| for (let index = 0; index < this.bodyRows.length; index++) { | ||
| const row = this.bodyRows[index]; | ||
|
|
||
| if (!isHidden(row)) { | ||
| this.firstVisibleBodyRowPosition ??= row.positionAll; | ||
| this.lastVisibleBodyRowPosition = row.positionAll; | ||
| } | ||
| } | ||
|
|
||
| for (let index = this.allRows.length - 1; index >= 0; index--) { | ||
| const row = this.allRows[index]; | ||
|
|
||
| if (!isHidden(row)) { | ||
| this.lastVisibleTableRowPosition = row.positionAll; | ||
| break; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue: #14766
Summary
✨🚀✨