Skip to content

fix(Table): tree rerenders#149

Closed
chelentos wants to merge 21 commits intomainfrom
fix/tree-rerenders
Closed

fix(Table): tree rerenders#149
chelentos wants to merge 21 commits intomainfrom
fix/tree-rerenders

Conversation

@chelentos
Copy link
Copy Markdown
Contributor

No description provided.

chelentos and others added 7 commits April 24, 2026 20:04
Identifies why enabling experimentalMemoization in arcadia QuotasTable3
yielded no measurable change: inline rowAttributes, custom context
fanout in TreeExpandableCell, and MemoBaseCell exported but never wired
into BaseRow. Plans a coordinated library + consumer fix plus dev-only
warning hook and migration doc.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ation

Add an internal `Cell` prop to `BaseRow` (defaults to `BaseCell`) and thread
`MemoBaseCell` through `MemoBaseRow` so that cell-level memoization is active
when `experimentalMemoization` is enabled. Adds a regression test that asserts
cell renderers do not re-run when only the row className changes.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@gravity-ui-bot
Copy link
Copy Markdown
Contributor

Preview is ready.

Andrei Timofeev and others added 14 commits April 27, 2026 16:41
Spec for a one-line BaseCell change (useContext(RowStateContext))
that makes row.getIsExpanded() / row.getIsSelected() memo-safe inside
cell render fns, removing the need for consumers to import
useIsExpanded. Includes a currently-red regression test that proves
the bug exists today and will turn green once the fix lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Library change is doc-only: rewrite migration guide to lead with
the TreeExpandableCell component (already exported, already
encapsulates useIsExpanded internally). Consumer drops their local
chevron component and uses the library's directly. useIsExpanded
remains exported as the escape hatch for custom row-state-aware UI.

Supersedes the rejected auto-subscribe approach (over-rendered
cells of the toggled row).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Rewrite anti-pattern #3 and the worked example to lead with the
library's TreeExpandableCell component. useIsExpanded is demoted
to an advanced 'Building your own analogue' sub-section for
consumers who need custom chevron styling. row.getIsExpanded()
inside a memoized cell remains an explicit anti-pattern.
Thread row state into areCellPropsEqual so MemoBaseCell re-renders
when expansion or selection changes. Consumers can now call
row.getIsExpanded() directly in any cell render function under
experimentalMemoization without useIsExpanded.
Pass isExpanded/isSelected to all Cell call sites so MemoBaseCell's
comparator can detect row state changes without a context subscription.
Delete RowStateContext.ts and migrate all callers (BaseGroupHeader,
TreeExpandableCell, stories) to row.getIsExpanded() directly.
Remove useIsExpanded from all guidance — it no longer exists.
row.getIsExpanded() now works correctly in any cell render fn under
experimentalMemoization. Remove the 'Building your own analogue'
sub-section and update anti-pattern #2 Fix and the 'What memoization
does not fix' bullet accordingly.
@chelentos chelentos force-pushed the fix/tree-rerenders branch from d697d2f to 898879f Compare April 29, 2026 12:29
@chelentos chelentos marked this pull request as ready for review April 29, 2026 12:34
@chelentos chelentos changed the title [WIP] fix(Table): tree rerenders fix(Table): tree rerenders Apr 29, 2026
@chelentos chelentos closed this Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants