-
-
Notifications
You must be signed in to change notification settings - Fork 969
fix(CheckTree): allow parent nodes to be selected when all children are disabled #4446
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
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
|
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. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…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
aaed9cf to
55ce65d
Compare
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
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
isEveryChildCheckedandisSomeChildCheckedto filter out disabled children from check state calculations - Enhanced
getDisabledStateto check if any parent node is disabled (cascading disabled state) - Added
disabledItemValuesparameter 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.
|
Deployment failed with the following error: |
|
Deployment failed with the following error: |
Fixes #4346