Repository navigation
feat(cli): codemod to migrate tree-mode useTableRowExpansion to the tree plugin (#4142) - #4884
Merged
humbertovirtudes merged 1 commit intoAug 11, 2026
Conversation
humbertovirtudes
requested review from
cixzhang,
imdreamrunner and
josephfarina
as code owners
August 11, 2026 08:09
|
@humbertovirtudes is attempting to deploy a commit to the Meta Open Source Team on Vercel. A member of the Team first needs to authorize it. |
…he tree plugin (meta#4142) useTableRowExpansion became a detail-panel plugin (meta#4609) and useTableRowExpansionState was removed. This adds a v0.3.0 codemod so `astryx upgrade` migrates the old tree pattern automatically: const {data, expansionConfig} = useTableRowExpansionState({ baseData, getChildren, getRowKey, expandedKeys, setExpandedKeys, }); const expansion = useTableRowExpansion(expansionConfig); becomes: const {visibleData: data, treeConfig} = useTableTreeState({ data: baseData, childrenKey: 'children', idKey: getRowKey, ... }); const expansion = useTableTreeData(treeConfig); It remaps the config (baseData -> data, getChildren -> childrenKey, getRowKey -> idKey, getIsItemExpandable -> isItemExpandable), fixes the imports, and leaves a guidance comment about expansion state (the controlled expandedKeys/setExpandedKeys mapping is not mechanical). Detail-panel usage (renderExpanded, no useTableRowExpansionState import) is left untouched. Tests: 10 unit tests (RED-verified first); full v0.3.0 codemod suite green (104); registered in the v0.3.0 manifest; eslint + changeset clean.
humbertovirtudes
force-pushed
the
feat/table-row-expansion-codemod
branch
from
August 11, 2026 08:19
a1354f0 to
9354446
Compare
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
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.
Summary
Follow-up to #4609: an automated migration codemod so consumers of the old tree-mode
useTableRowExpansioncan move to the tree plugin viaastryx upgrade, not by hand.#4609 turned
useTableRowExpansioninto a detail-panel plugin (renderExpanded) and removeduseTableRowExpansionState. That PR shipped a migration guide; this adds the migration script.What it does
A
v0.3.0codemod,migrate-table-rowexpansion-to-tree, that rewrites the standard tree pattern:into:
It:
useTableRowExpansionStatecall touseTableTreeStateand remaps the config (baseData->data,getChildren->childrenKey: 'children',getRowKey->idKey,getIsItemExpandable->isItemExpandable).data->visibleData: data,expansionConfig->treeConfig) and swaps the plugin call touseTableTreeData.expandedKeys/setExpandedKeyswiring does not map 1:1 (the tree hook is uncontrolled by default, or takesexpandedIds+onExpandedIdsChange). This is the one part a human should confirm.Safety
renderExpandedwith nouseTableRowExpansionStateimport are the new API, not a migration target).@astryxdesign/coreand@xds/coreimport sources.Test plan
getIsItemExpandable, shorthand output, guidance comment, detail-panel no-op, non-consumer no-op,@xds/corealias).v0.3.0manifest; fullv0.3.0codemod suite green (104), includingnext-codemodsmanifest validation.eslintclean;check:changesetsvalid.