From 82ebd0eb445a7c8c9b8671191bfa777dbe1b73c5 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Mon, 12 Jun 2023 15:40:59 +0800 Subject: [PATCH] refactor: child and parent field are not linked (#2030) --- .../DataTemplates/hooks/useCollectionState.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/core/client/src/schema-settings/DataTemplates/hooks/useCollectionState.ts b/packages/core/client/src/schema-settings/DataTemplates/hooks/useCollectionState.ts index eecd7c811..8a08146cb 100644 --- a/packages/core/client/src/schema-settings/DataTemplates/hooks/useCollectionState.ts +++ b/packages/core/client/src/schema-settings/DataTemplates/hooks/useCollectionState.ts @@ -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); }