Skip to content

Commit 48c00e7

Browse files
committed
key to string before check
1 parent dc2c3fc commit 48c00e7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/util.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,15 @@ export function calcCheckStateConduct(treeNodes, checkedKeys) {
350350
};
351351
}
352352

353+
/**
354+
* Since React internal will convert key to string,
355+
* we need do this to avoid `checkStrictly` use number match
356+
*/
357+
function keyListToString(keyList) {
358+
if (!keyList) return keyList;
359+
return keyList.map(key => String(key));
360+
}
361+
353362
/**
354363
* Calculate the value of checked and halfChecked keys.
355364
* This should be only run in init or props changed.
@@ -379,6 +388,9 @@ export function calcCheckedKeys(keys, props) {
379388
return null;
380389
}
381390

391+
keyProps.checkedKeys = keyListToString(keyProps.checkedKeys);
392+
keyProps.halfCheckedKeys = keyListToString(keyProps.halfCheckedKeys);
393+
382394
// Do nothing if is checkStrictly mode
383395
if (checkStrictly) {
384396
return keyProps;

0 commit comments

Comments
 (0)