You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DataTable: toggling one row's selection re-renders every cell #8716
Part of #8676 (P1). Measure with #8714 before and after.
Problem
DataTable/useTable.ts (createRow, about :292-318) builds new row and cell objects on every render, with selected baked in at :309. TableRow (Table.tsx:264) and TableCell (:289) aren't memoized. Every row and cell therefore re-renders whenever any selection changes.
Measured: with 200 rows by 3 columns, mounting calls renderCell 600 times. Toggling one row's checkbox calls it 600 more times.
Passing a new data array also re-sorts and rebuilds every row (useTable.ts:177-181).
Proposed fix
Cache row objects by source row plus selected and selectable, so unchanged rows keep their identity.
Render rows through a memoized row component.
Document that data and columns should be referentially stable.
The fix must work on React 18 and 19.
Acceptance criteria
Toggling one row re-renders only that row's cells, plus the header and bulk-action state. Add a test that counts renderCell calls.
Sorting, grouping, row selection and select-all behave the same as before.
Activity