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 }) => { const onCheck = useCallback((checkedKeys, { node, checked }) => {
if (checked) { if (checked) {
let parentKey = node.key.split('.').slice(0, -1).join('.'); // let parentKey = node.key.split('.').slice(0, -1).join('.');
try { try {
// 当子节点被选中时,也选中所有祖先节点,提高用户辨识度 // 当子节点被选中时,也选中所有祖先节点,提高用户辨识度
while (parentKey) { // while (parentKey) {
if (parentKey) { // if (parentKey) {
checkedKeys.checked = _.uniq([...checkedKeys.checked, parentKey]); // checkedKeys.checked = _.uniq([...checkedKeys.checked, parentKey]);
} // }
// parentKey = parentKey.split('.').slice(0, -1).join('.');
parentKey = parentKey.split('.').slice(0, -1).join('.'); // }
}
} catch (err) { } catch (err) {
error(err); error(err);
} }