refactor: child and parent field are not linked (#2030)

This commit is contained in:
katherinehhh 2023-06-12 15:40:59 +08:00 committed by GitHub
parent f1feb56743
commit 82ebd0eb44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -154,17 +154,16 @@ export const useCollectionState = (currentCollectionName: string) => {
const onCheck = useCallback((checkedKeys, { node, checked }) => {
if (checked) {
let parentKey = node.key.split('.').slice(0, -1).join('.');
// let parentKey = node.key.split('.').slice(0, -1).join('.');
try {
// 当子节点被选中时,也选中所有祖先节点,提高用户辨识度
while (parentKey) {
if (parentKey) {
checkedKeys.checked = _.uniq([...checkedKeys.checked, parentKey]);
}
parentKey = parentKey.split('.').slice(0, -1).join('.');
}
// while (parentKey) {
// if (parentKey) {
// checkedKeys.checked = _.uniq([...checkedKeys.checked, parentKey]);
// }
// parentKey = parentKey.split('.').slice(0, -1).join('.');
// }
} catch (err) {
error(err);
}