Skip to content

Conversation

@simonguo
Copy link
Member

@simonguo simonguo commented Dec 5, 2025

  • Modified isEveryChildChecked to ignore disabled children and return parent's own check state when all children are disabled
  • Modified isSomeChildChecked to skip disabled children
  • Added disabledItemValues parameter to getNodeCheckState, getFormattedTree, and useVirtualizedTreeData
  • Fixed issue where clicking parent node would incorrectly select disabled children
  • Fixed issue where parent nodes with all disabled children could not be selected
  • Added test cases to verify the behavior

Fixes #4346

@codesandbox
Copy link

codesandbox bot commented Dec 5, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 5, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@vercel
Copy link

vercel bot commented Dec 5, 2025

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

Project Deployment Preview Comments Updated (UTC)
rsuite-main Ready Ready Preview Comment Dec 10, 2025 2:35am
rsuite-storybook Ready Ready Preview Comment Dec 10, 2025 2:35am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
rsuite-v5 Ignored Ignored Preview Dec 10, 2025 2:35am

…re disabled

- Modified isEveryChildChecked to ignore disabled children
  and return parent's own check state when all children are disabled
- Modified isSomeChildChecked to skip disabled children
- Added disabledItemValues parameter to getNodeCheckState,
  getFormattedTree, and useVirtualizedTreeData
- Fixed issue where clicking parent node would incorrectly
  select disabled children
- Fixed issue where parent nodes with all disabled children
  could not be selected
- Added test cases to verify the behavior

Fixes #4346
@codecov
Copy link

codecov bot commented Dec 5, 2025

Codecov Report

❌ Patch coverage is 97.14286% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.48%. Comparing base (7006a5a) to head (0d11da8).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/CheckTree/utils.ts 94.11% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4446   +/-   ##
=======================================
  Coverage   94.47%   94.48%           
=======================================
  Files         559      559           
  Lines       13740    13792   +52     
  Branches     4081     4105   +24     
=======================================
+ Hits        12981    13031   +50     
- Misses        687      689    +2     
  Partials       72       72           
Flag Coverage Δ
chromium 94.48% <97.14%> (+<0.01%) ⬆️
firefox 94.48% <97.14%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an issue where parent nodes in a CheckTree component could not be selected when all their children were disabled. The changes modify the check state calculation logic to ignore disabled children and allow parent nodes to maintain their own selectable state.

Key Changes

  • Modified isEveryChildChecked and isSomeChildChecked to filter out disabled children from check state calculations
  • Enhanced getDisabledState to check if any parent node is disabled (cascading disabled state)
  • Added disabledItemValues parameter throughout the component hierarchy to support the new behavior

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/CheckTree/utils.ts Core logic changes to ignore disabled children in check state calculations and cascade disabled state from parent to children
src/CheckTree/hooks/useTreeCheckState.ts Added logic to skip checking disabled nodes and prevent setting checkAll when disabled descendants exist
src/Tree/hooks/useFlattenTree.ts Added logic to skip disabled nodes during cascade operations
src/Tree/hooks/useVirtualizedTreeData.ts Threaded disabledItemValues parameter through to getNodeCheckState
src/CheckTree/CheckTree.tsx Passed disabledItemValues to useFlattenTree hook
src/CheckTree/CheckTreeView.tsx Threaded disabledItemValues to useTreeCheckState and other components
src/CheckTreePicker/CheckTreePicker.tsx Passed disabledItemValues to useFlattenTree hook
src/CheckTree/test/CheckTree.spec.tsx Added comprehensive test cases for the new disabled children behavior
docs/pages/components/check-tree/fragments/disabled.md Updated example to reflect the new behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vercel
Copy link

vercel bot commented Dec 10, 2025

Deployment failed with the following error:

Resource is limited - try again in 2 minutes (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/rsuite?upgradeToPro=build-rate-limit

@vercel
Copy link

vercel bot commented Dec 10, 2025

Deployment failed with the following error:

Resource is limited - try again in 3 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/rsuite?upgradeToPro=build-rate-limit

@simonguo simonguo merged commit 63e76e4 into main Dec 10, 2025
15 of 17 checks passed
@simonguo simonguo deleted the fix/check-tree-disabled-children branch December 10, 2025 05:41
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.

[CheckTree] Children of disabled nodes should also be disabled

2 participants