Skip to content

Conversation

@ugjjffu
Copy link

@ugjjffu ugjjffu commented Oct 24, 2025

🎯 Changes

I fixed a logic bug in the toggleExpanded function that led to an incorrect calculation of tableDepth. The original logic only deleted the expanded row's ID, but it failed to recursively delete the IDs of its hidden child rows. I fixed this bug by implementing a recursive deletion mechanism to ensure all dependent child rows are correctly removed from the expanded state.

✅ Checklist

  • [ ✅️] I have followed the steps in the Contributing guide.
  • [ ✅️] I have tested this code locally with pnpm test:pr.

🚀 Release Impact

  • [ ✅️] This change affects published code, and I have generated a changeset.
  • [❌️ ] This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved row collapsing behavior. When you collapse an expanded row, the row and all its nested descendant rows are now properly removed from the expanded state while preserving other rows' states.
  • Breaking Changes

    • Major version update includes a fix to how the maximum depth of expanded rows is calculated.

@changeset-bot
Copy link

changeset-bot bot commented Oct 24, 2025

🦋 Changeset detected

Latest commit: 5c43c9c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@tanstack/table-core Major
@tanstack/angular-table Patch
@tanstack/lit-table Patch
@tanstack/qwik-table Patch
@tanstack/react-table Patch
@tanstack/solid-table Patch
@tanstack/svelte-table Patch
@tanstack/vue-table Patch
@tanstack/react-table-devtools Patch

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

@coderabbitai
Copy link

coderabbitai bot commented Oct 24, 2025

Walkthrough

The row expansion feature now removes collapsed rows and their entire descendant hierarchy from the expanded state, rather than just removing the single row entry. This ensures complete cleanup of nested expanded rows when a parent row is collapsed.

Changes

Cohort / File(s) Summary
Row Expansion Logic
packages/table-core/src/features/RowExpanding.ts
Modified collapse behavior to filter out all keys starting with the current row's id, removing the row and all its descendants from expanded state instead of single-key removal
Changeset Entry
.changeset/every-grapes-judge.md
Added changeset documenting major version bump for @tanstack/table-core with API fix for calculating maximum depth of expanded rows

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

Down the tree of rows so wide,
Collapse the branch, its children hide,
No orphans left to expand in vain,
Clean state reigns, descendants wane! 🐰✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "feat(table-core): fix API to calculate max expanded row depth" is directly related to the main change in the pull request. The changeset and code modifications address a bug in the toggleExpanded function where collapsing a row now correctly removes the expanded state for that row and all its descendants by filtering keys that start with the row's id, rather than just removing a single entry. This fix ensures the tableDepth calculation becomes accurate, which is exactly what the title references. The title is concise, specific enough for scanning history, and accurately captures the intent of the fix.
Description Check ✅ Passed The PR description follows the required template structure with all three sections present and appropriately filled. The 🎯 Changes section clearly explains the bug in toggleExpanded and describes the recursive deletion fix implemented to resolve the tableDepth calculation issue. The ✅ Checklist section confirms both contributing guide compliance and local testing were completed. The 🚀 Release Impact section indicates the change affects published code and a changeset was generated. All required information is provided with sufficient detail.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 207f890 and 5c43c9c.

📒 Files selected for processing (1)
  • .changeset/every-grapes-judge.md (1 hunks)
🔇 Additional comments (1)
.changeset/every-grapes-judge.md (1)

1-5: Verify the changeset description and version bump level.

The description "fix API to calculate max expanded row depth" could be more specific. Based on the PR context, the actual fix involves recursively removing descendant row IDs from the expanded state when collapsing a parent row (previously only the parent was removed).

Additionally, the "major" version bump should be verified as appropriate for this change. While this fixes a logic bug with a behavioral impact, confirm whether this is truly a breaking API change that warrants a major version.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 02c203a and 88ea0e8.

📒 Files selected for processing (2)
  • examples/react/basic/src/data.ts (1 hunks)
  • packages/table-core/src/features/RowExpanding.ts (1 hunks)
🔇 Additional comments (1)
examples/react/basic/src/data.ts (1)

1-44: LGTM! Well-structured example data.

The hierarchical data structure with multi-level nesting effectively demonstrates the row expansion functionality. The inline comment on line 6 and line 27 helpfully highlight the nesting capability.

ugjjffu and others added 4 commits October 24, 2025 23:03
agree

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.

1 participant