Skip to content

Conversation

YannickRe
Copy link
Contributor

Q A
Bug fix? [X]

What's in this Pull Request?

Fixes the selection of children when passed in as defaultSelectedKeys. Before, when a parent matched a key the children weren't checked any more if they were also part of defaultSelectedKeys. As a result, only the parent showed as selected. This is now fixed.

Deprecated selectChildrenIfParentSelected and added selectChildrenMode. This is a flagged enum which allows much more flexibility on when this before should be triggered. Currently, the behavior is triggered on mount, update (when new props are passed), select and unselect. As a result, you can never pass in the key of a parent and just one of its children as all of the children will be selected. With the change to a flagged enum, you can control all 4 lifetime moments separately.

Old behavior can be replicated with SelectChildrenMode.None and SelectChildrenMode.All. For more granular control can also be set to eg. SelectChildrenMode.Select | SelectChildrenMode.Unselect, which means that children will be selected/unselected when the parent is selected or unselected but not when the control mounts OR when the props are updated.

…some children's keys are passed in as well to be default selected.

Added way more flexibility to decide when in the lifecycle the children of a selected item should be selected too.
@AJIXuMuK
Copy link
Collaborator

Thank you @YannickRe!
The PR has been merged and is available in v2-beta for tests.

@AJIXuMuK AJIXuMuK added this to the 2.7.0 milestone Apr 11, 2021
@AJIXuMuK
Copy link
Collaborator

I've also cherry-picked it to v3

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.

2 participants