fix: TableView height collapse when no fixed height given for empty a…#10321
Draft
rima10 wants to merge 1 commit into
Draft
fix: TableView height collapse when no fixed height given for empty a…#10321rima10 wants to merge 1 commit into
rima10 wants to merge 1 commit into
Conversation
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.
Issue
Closes #10235
Summary
Fixes TableView height collapse when no explicit height is provided for empty and loading states. The table now auto-sizes to show column headers and empty state content without requiring a fixed height container.
Root Cause
The S2TableLayout was deriving the empty/loading body's Rect height from
this.virtualizer!.size.height, creating a circular dependency:Solution
Moved empty-state rendering outside the size-locked virtualizer box to a sibling rowgroup that sizes itself by actual content:
Changes Made:
packages/react-aria-components/src/Table.tsx
renderTableEmptyState()helper to factor empty-state row/cell markupemptyStateconditional on!isVirtualizedrole="rowgroup"withdata-empty="true"packages/@react-spectrum/s2/src/TableView.tsx
.tablestyle todisplay: flex; flex-direction: columnfor proper flex layoutbuildCollection()buildRowGroup()to reset height for empty/loading case from base layout's circular value to actual computed heightRectimportpackages/@react-spectrum/s2/stories/TableView.stories.tsx
height: 320→ allows auto-sizeTesting
Behavior Change
styles={{ height: N }}✅ Checklist
📝 Test Instructions
Storybook:
packages/@react-spectrum/s2/stories/TableView.stories.tsxEmptyStateNoHeightstory (no explicit height)EmptyStatestory (has explicit width only)Manual Testing: