-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[BUG] ignore non expandable rows when the expanded state changes #6116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[BUG] ignore non expandable rows when the expanded state changes #6116
Conversation
🦋 Changeset detectedLatest commit: 35541e2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughRowExpanding now filters rows by their canExpand capability when toggling all-expanded; only rows that can expand are marked expanded. Other expanded-state handling and single-row expansion logic remain unchanged. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant T as Table UI
participant R as RowExpanding
participant S as ExpandedState
U->>T: click "toggle all expanded"
T->>R: toggleAllRowsExpanded(old = true)
alt old === true
R->>R: iterate visible row IDs
loop per row
R->>R: call getCanExpand(rowId)
alt canExpand == true
R->>S: mark rowId as expanded (oldExpanded[rowId] = true)
else canExpand == false
R-->>S: skip rowId
end
end
else old === false
R->>S: clear expanded state (unchanged behavior)
end
R->>T: call onExpandedChange(mapped setExpanded)
T->>U: UI updates accordingly
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/table-core/src/features/RowExpanding.ts (1)
211-213
: Revert unnecessary stylistic change.The block statement with explicit return is functionally identical to the concise arrow body. Since
setExpanded
returnsvoid
, consider reverting to the more concise form for consistency:-table.setExpanded = updater => { - return table.options.onExpandedChange?.(updater) -} +table.setExpanded = updater => table.options.onExpandedChange?.(updater)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/table-core/src/features/RowExpanding.ts
(2 hunks)
🔇 Additional comments (1)
packages/table-core/src/features/RowExpanding.ts (1)
299-304
: Good fix! Verify existing tests cover this scenario.This correctly filters out non-expandable rows when converting from
expanded: true
to an explicit object state. Previously, all rows were marked as expanded regardless of theircanExpand()
status, which could lead to inconsistent state.Please verify that this change is covered by tests:
@coderabbitai help |
ChatThere are 3 ways to chat with CodeRabbit:
CodeRabbit commands
Other keywords and placeholders
CodeRabbit configuration file (
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
✅ Actions performedReview triggered.
|
🎯 Changes
Resolving the issue I bought up in #6115 where if the old expanded state is
true
and you change any of the expanded rows. It will also include rows that don't have expanded rows. This was then causing a situation where thegetExpandedDepth
function was returning the wrong number as the state included rows that shouldn't have been includedI have just added a check to see if that row should be expandable before it gets added to the expandable state.
✅ Checklist
pnpm test:pr
.🚀 Release Impact
Summary by CodeRabbit