Repository navigation
fix(Table): prevent useXDSTableSelection from overrendering all rows - #1004
Merged
Merged
Conversation
cixzhang
force-pushed
the
navi/fix/table-selection-perf
branch
2 times, most recently
from
March 31, 2026 04:48
786a1e2 to
b4fc604
Compare
Replace Context-based approach with an external store pattern using useSyncExternalStore for fine-grained row subscriptions: - SelectionStore: lightweight store holding config via ref, keeping the plugin object referentially stable across renders - SelectionRowContent: each row subscribes to its own selection state. Only re-renders when *this specific item's* selection changes - SelectAllCheckbox: subscribes to all-selected/indeterminate independently - Imperative DOM updates: aria-selected and background color applied via useEffect on parent <tr>, avoiding memoized row wrapper re-renders Before: selecting 1 row in 100-row table = 100 row re-renders After: selecting 1 row in 100-row table = 1 row re-render Adds 2 perf tests verifying only the affected row re-renders. All 100 existing table tests pass. Closes #195 Co-authored-by: Navi <[email protected]>
cixzhang
force-pushed
the
navi/fix/table-selection-perf
branch
from
March 31, 2026 05:14
b4fc604 to
43f41b0
Compare
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsTable · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
added a commit
that referenced
this pull request
Apr 26, 2026
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
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.
Problem
When selecting a row, all rows re-render — not just the selected one.
Root Cause
useMemodepended onconfig, recreated each render (closures over selection state)MemoizedTableRowcomparespluginsby reference — new plugin = all rows re-rendertransformBodyRowread selection state inline, coupling every row to full stateSolution
External store pattern via
useSyncExternalStore:<tr>Before: select 1 row in 100 → 100 re-renders
After: select 1 row in 100 → 1 re-render
Tests
Revives #205 (closed for focus time). Closes #195