Skip to content

perf(table): improve performance#14817

Draft
jcfranco wants to merge 2 commits into
devfrom
jcfranco/14766-improve-table-performance
Draft

perf(table): improve performance#14817
jcfranco wants to merge 2 commits into
devfrom
jcfranco/14766-improve-table-performance

Conversation

@jcfranco

@jcfranco jcfranco commented Jul 15, 2026

Copy link
Copy Markdown
Member

Related Issue: #14766

Summary

✨🚀✨

@github-actions github-actions Bot added the chore Issues with changes that don't modify src or test files. label Jul 15, 2026
@jcfranco
jcfranco force-pushed the jcfranco/14766-improve-table-performance branch from a806cbc to 92e6dd4 Compare July 15, 2026 19:23
@jcfranco jcfranco changed the title chore: deny install scripts perf(table): improve performance Jul 15, 2026
@jcfranco
jcfranco requested a review from Copilot July 15, 2026 19:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-header to 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;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Issues with changes that don't modify src or test files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants