diff --git a/web/app/components/workflow/skill/file-tree.tsx b/web/app/components/workflow/skill/file-tree.tsx index 3a7e6f4e89..3b3a61dcff 100644 --- a/web/app/components/workflow/skill/file-tree.tsx +++ b/web/app/components/workflow/skill/file-tree.tsx @@ -4,6 +4,7 @@ import type { NodeApi, TreeApi } from 'react-arborist' import type { OpensObject } from './store' import type { TreeNodeData } from './type' import { RiDragDropLine } from '@remixicon/react' +import { useSize } from 'ahooks' import * as React from 'react' import { useCallback, useEffect, useMemo, useRef } from 'react' import { Tree } from 'react-arborist' @@ -37,6 +38,8 @@ const DropTip = () => { const FileTree: React.FC = ({ className }) => { const { t } = useTranslation('workflow') const treeRef = useRef>(null) + const containerRef = useRef(null) + const containerSize = useSize(containerRef) const appDetail = useAppStore(s => s.appDetail) const appId = appDetail?.id || '' @@ -132,14 +135,17 @@ const FileTree: React.FC = ({ className }) => { return (
-
+
ref={treeRef} data={treeData.children} idAccessor="id" childrenAccessor="children" width="100%" - height={1000} + height={containerSize?.height ?? 400} rowHeight={24} indent={20} overscanCount={5}