### What problem does this PR solve? fix: fetch file list by react-query #1306 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useSelectFileList } from '@/hooks/file-manager-hooks';
|
||||
import { useFetchNextFileList } from '@/hooks/file-manager-hooks';
|
||||
import { IFile } from '@/interfaces/database/file-manager';
|
||||
import { formatDate } from '@/utils/date';
|
||||
import { Button, Flex, Space, Table, Tag, Typography } from 'antd';
|
||||
@@ -6,7 +6,6 @@ import { ColumnsType } from 'antd/es/table';
|
||||
import ActionCell from './action-cell';
|
||||
import FileToolbar from './file-toolbar';
|
||||
import {
|
||||
useGetFilesPagination,
|
||||
useGetRowSelection,
|
||||
useHandleConnectToKnowledge,
|
||||
useHandleCreateFolder,
|
||||
@@ -30,7 +29,7 @@ const { Text } = Typography;
|
||||
|
||||
const FileManager = () => {
|
||||
const { t } = useTranslate('fileManager');
|
||||
const fileList = useSelectFileList();
|
||||
// const fileList = useSelectFileList();
|
||||
const { rowSelection, setSelectedRowKeys } = useGetRowSelection();
|
||||
const loading = useSelectFileListLoading();
|
||||
const navigateToOtherFolder = useNavigateToOtherFolder();
|
||||
@@ -64,8 +63,9 @@ const FileManager = () => {
|
||||
initialValue,
|
||||
connectToKnowledgeLoading,
|
||||
} = useHandleConnectToKnowledge();
|
||||
const { pagination } = useGetFilesPagination();
|
||||
|
||||
// const { pagination } = useGetFilesPagination();
|
||||
const { pagination, data, searchString, handleInputChange } =
|
||||
useFetchNextFileList();
|
||||
const columns: ColumnsType<IFile> = [
|
||||
{
|
||||
title: t('name'),
|
||||
@@ -151,13 +151,15 @@ const FileManager = () => {
|
||||
return (
|
||||
<section className={styles.fileManagerWrapper}>
|
||||
<FileToolbar
|
||||
searchString={searchString}
|
||||
handleInputChange={handleInputChange}
|
||||
selectedRowKeys={rowSelection.selectedRowKeys as string[]}
|
||||
showFolderCreateModal={showFolderCreateModal}
|
||||
showFileUploadModal={showFileUploadModal}
|
||||
setSelectedRowKeys={setSelectedRowKeys}
|
||||
></FileToolbar>
|
||||
<Table
|
||||
dataSource={fileList}
|
||||
dataSource={data?.files}
|
||||
columns={columns}
|
||||
rowKey={'id'}
|
||||
rowSelection={rowSelection}
|
||||
|
||||
Reference in New Issue
Block a user