Skip to content

docs(core): useTableRowExpansion to tree-plugin migration guide (#4142) - #4584

Merged
humbertovirtudes merged 1 commit into
meta:mainfrom
humbertovirtudes:docs/tree-migration-guide
Jul 31, 2026
Merged

humbertovirtudes merged 1 commit into
meta:mainfrom
humbertovirtudes:docs/tree-migration-guide

Conversation

@humbertovirtudes

Copy link
Copy Markdown
Contributor

Summary

Third step of the tree-plugin convergence tracked in #4142: document the migration path from useTableRowExpansion to useTableTreeData + useTableTreeState.

With the expand-all header control (#4172) and whole-row-click expansion (#4548) folded in, useTableTreeData now covers useTableRowExpansion's affordances, and does so with a cycle guard, per-row fine-grained re-render, and imperative row ARIA. This PR gives consumers of the older plugin a clear path to the surviving one, ahead of deprecation and removal.

What changed

packages/core/src/Table/useTableRowExpansion.doc.mjs:

  • Description: a sentence noting the convergence and pointing new tree tables at useTableTreeData + useTableTreeState.
  • Two examples added to the doc:
    1. Migrating to useTableTreeData + useTableTreeState: a before/after code sample.
    2. Config mapping: a line-by-line prop mapping.

The guide surfaces via astryx component useTableRowExpansion --detail full and the docs pipeline (verified locally).

Config mapping

useTableRowExpansion(State) useTableTreeState / useTableTreeData
baseData: T[] (nested) data: T[]
getChildren: item => item.children childrenKey: 'children'
getRowKey: item => item.id idKey: 'id' or idKey={item => item.id}
getIsItemExpandable isItemExpandable
expandedKeys + setExpandedKeys defaultExpandedIds (uncontrolled) or expandedIds + onExpandedIdsChange
getDepth removed (depth derives from nesting)
isAllExpanded + onToggleExpandAll hasExpandAllControl (state is computed)
hasRowClickExpansion hasRowClickExpansion (unchanged)

idKey already accepts a function, so a custom getRowKey maps cleanly with no new API.

Not in this PR

Deprecation (JSDoc @deprecated + docs banner) and eventual removal of useTableRowExpansion follow as separate changes. A version-keyed codemod belongs to the removal release, since the plugin still exists and works today.

Test plan

  • astryx component useTableRowExpansion --detail full renders the updated description and both example sections.
  • tsc --project packages/core/tsconfig.docs.json: clean.
  • eslint on the changed file: clean.
  • check:changesets: valid.

…eta#4142)

The tree plugins are converging: useTableTreeData + useTableTreeState now
cover useTableRowExpansion's affordances (expand-all header control meta#4172,
whole-row click meta#4548) with a cycle guard and fine-grained re-render.

Add a migration guide to the useTableRowExpansion docs so consumers have a
clear path to the surviving plugin:
- a before/after example (useTableRowExpansion + State -> useTableTreeState
  + useTableTreeData)
- a full config mapping (baseData -> data, getChildren -> childrenKey,
  getRowKey -> idKey, getDepth removed, isAllExpanded/onToggleExpandAll ->
  hasExpandAllControl, hasRowClickExpansion unchanged)

Surfaces via `astryx component useTableRowExpansion --detail full` and the
docs pipeline. Deprecation and removal follow in later changes.
@vercel

vercel Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview Jul 31, 2026 8:58am

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

Table (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1938 -
Complexity N/A Very High (110) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.7KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

github-actions Bot added a commit that referenced this pull request Jul 31, 2026
@humbertovirtudes
humbertovirtudes merged commit 0f688f8 into meta:main Jul 31, 2026
17 checks passed
humbertovirtudes added a commit that referenced this pull request Jul 31, 2026
…4142) (#4587)

Fourth step of the tree-plugin convergence. useTableTreeData +
useTableTreeState now cover useTableRowExpansion's affordances
(expand-all header control #4172, whole-row click #4548) with a cycle
guard and fine-grained re-render, and the migration guide landed in
#4584.

Mark the older plugin deprecated without removing it:
- @deprecated JSDoc on useTableRowExpansion and
  useTableRowExpansionState (and the file header), each pointing to the
  tree plugin and the migration guide.
- Prefix the doc.mjs descriptions with "Deprecated: use useTableTreeData
  + useTableTreeState instead", so it shows in the docs and via
  `astryx component useTableRowExpansion`.

The hooks still work; existing consumers are unaffected. Removal and a
version-keyed codemod follow in a later release.

This branch was successfully deployed

1 active deployment
Preview — 724557c2 Deployed Jul 31, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant