Skip to content
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

fix(TreeSelect): calculate all checked value only when treeCheckedStrategy=all, close#3936 #3938

Merged
merged 5 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/tree-select/tree-select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,11 @@ class TreeSelect extends Component {
const nonExistentValueKeys = this.getNonExistentValueKeys();

let keys = this.getKeysByValue(value);
keys = getAllCheckedKeys(keys, this.state._k2n, this.state._p2n);

if (treeCheckedStrategy !== 'child') {
// there's no need to calculate all checked value when treeCheckedStrategy=child, close #3936
keys = getAllCheckedKeys(keys, this.state._k2n, this.state._p2n);
}

switch (treeCheckedStrategy) {
case 'parent':
Expand Down
2 changes: 1 addition & 1 deletion test/time-picker2/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ describe('TimePicker2', () => {

assert.deepEqual(getStrValue(wrapper), ['11:12:13', '12:00:00'])
})
it.only('should render with value controlled', () => {
it('should render with value controlled', () => {
wrapper = mount(<TimeRangePicker value={[defaultValue, defaultValue.add(1, 'hours')]} />);

assert.deepEqual(getStrValue(wrapper), ['11:12:13', '12:12:13'])
Expand Down