refactor(DirectoryTree): simplify code (#38184)

This commit is contained in:
zz 2022-10-23 18:33:47 +08:00 committed by GitHub
parent 2a1f2836f4
commit 9d9447e54f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,10 +52,6 @@ const DirectoryTree: React.ForwardRefRenderFunction<RcTree, DirectoryTreeProps>
const cachedSelectedKeys = React.useRef<Key[]>();
const treeRef = React.createRef<RcTree>();
React.useImperativeHandle(ref, () => treeRef.current!);
const getInitExpandedKeys = () => {
const { keyEntities } = convertDataToEntities(getTreeData(props));
@ -191,7 +187,7 @@ const DirectoryTree: React.ForwardRefRenderFunction<RcTree, DirectoryTreeProps>
return (
<Tree
icon={getIcon}
ref={treeRef}
ref={ref}
blockNode
{...otherProps}
showIcon={showIcon}