Repository navigation
perf(Table): build the row-index column once per plugin - #10654
Conversation
useTableRowIndex created a new column object on every Table render, so a parent re-render re-rendered every row of a table that shows row numbers. The column is now built with the plugin. This diff was generated with AI assistance (Navi). Tags: ai-generated
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Approved pending CI: CI is still running on this head.
useTableRowIndex now builds its index column once per plugin, so a parent re-render no longer re-renders unchanged rows. The new test fails without the change and passes with it, and the row numbers, header, width and alignment render as before.
Non-blocking:
- The comment added at
useTableRowIndex.tsx:94-95could follow the repository's plain-English comment style; see the inline suggestion.
[Automated review]
| // One column object per plugin, so a Table re-render keeps its resolved | ||
| // columns and leaves unchanged rows alone. |
There was a problem hiding this comment.
Non-blocking: this comment opens with a fragment that has no verb and uses the idiom “leaves … alone”. The source-comment rule (INV29 in docs/architecture/knowledge-contracts.md) asks for short, active sentences with no idioms. A version that keeps only the reason:
// Table re-renders every row when a column object changes. Build this column once per plugin.
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| TableBody | 3.5 kB (0) · 3.3 kB CSS (0) | — | ✓ · ✓ · ✗ |
| TableFooter | 3.5 kB (0) · 3.3 kB CSS (0) | — | ✓ · ✓ · ✗ |
| TableHeader | 3.5 kB (0) · 3.3 kB CSS (0) | — | ✓ · ✓ · ✗ |
5 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| TableRow | 6.9 kB (0) · 3.9 kB CSS (0) | — | ✓ · ✓ · ✗ |
| Table | 116.3 kB (0) · 17.7 kB CSS (0) | — | ✓ · ✓ · — |
| TableCell | 107.4 kB (0) · 17.4 kB CSS (0) | — | ✓ · ✓ · ✓ |
| TableHeaderCell | 107.0 kB (0) · 17.2 kB CSS (0) | — | ✓ · ✓ · ✓ |
| TableSelectionToolbar | 68.8 kB (0) · 13.0 kB CSS (0) | — | ✓ · ✓ · ✓ |
Package size: @astryxdesign/core 6.97 MB packed (+33 B); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 29 rows, core 40 rows; run pnpm api:report.
Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
Stack
Row virtualization is split into eight stacked PRs, each under the 2,000-line limit. Each PR's base is the one above it, so review and merge from the top of this list down.
Two record amendments the stack relies on: #10665 (Table adopts the shared list-windowing module first) and #10666 (a windowed row-number column fits its last position).
Maintainer impact
A table that uses
useTableRowIndexre-renders every row whenever its parent re-renders, even when no row changed. The plugin built a new index column on every Table render, so Table's resolved columns never stayed equal and every memoized row re-rendered.Intended invariant
A plugin column keeps its identity while the plugin's inputs stay the same, so a parent re-render leaves unchanged rows alone.
Change
useTableRowIndexbuilds its column once, with the plugin, instead of insidetransformColumns. Its width, label, renderer and numbering are unchanged.Evidence
Scope
Testing
--max-warnings=0) on every changed file, andpnpm typecheckinpackages/corepass on this exact head.vitest run --project ui packages/core: 20,605 tests pass. Four locale time-format tests (DateTimeInput,TimeInput,timeFormat) fail on the local machine's ICU data and pass in CI; they do not touch Table.node scripts/pre-review.mjs --base <the branch below>: 74 authored lines.This PR was generated with AI assistance (Navi).