diff --git a/projects/app/src/pageComponents/dataset/detail/CollectionCard/TagManageModal.tsx b/projects/app/src/pageComponents/dataset/detail/CollectionCard/TagManageModal.tsx index e032f8f27..102d70bec 100644 --- a/projects/app/src/pageComponents/dataset/detail/CollectionCard/TagManageModal.tsx +++ b/projects/app/src/pageComponents/dataset/detail/CollectionCard/TagManageModal.tsx @@ -18,10 +18,7 @@ import { import { useRequest2 } from '@fastgpt/web/hooks/useRequest'; import MyInput from '@/components/MyInput'; import { type DatasetTagType } from '@fastgpt/global/core/dataset/type'; -import { - type ScrollListType, - useVirtualScrollPagination -} from '@fastgpt/web/hooks/useScrollPagination'; +import { useScrollPagination } from '@fastgpt/web/hooks/useScrollPagination'; import EmptyTip from '@fastgpt/web/components/common/EmptyTip'; import PopoverConfirm from '@fastgpt/web/components/common/MyPopover/PopoverConfirm'; import { type DatasetCollectionsListItemType } from '@/global/core/dataset/type'; @@ -70,7 +67,7 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => { }), { onSuccess() { - fetchData(1); + refreshList(); setSearchTagKey(''); loadAllDatasetTags(); }, @@ -89,7 +86,7 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => { }, { onSuccess() { - fetchData(1); + refreshList(); setSearchTagKey(''); loadAllDatasetTags(); } @@ -124,59 +121,40 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => { // Tags list const { - scrollDataList: renderTags, - totalData: collectionTags, - ScrollList, - isLoading: isRequesting, - fetchData, + data: collectionTags, + ScrollData, + refreshList, total: tagsTotal - } = useVirtualScrollPagination(getDatasetCollectionTags, { - refreshDeps: [''], - // debounceWait: 300, - - itemHeight: 56, - overscan: 10, - + } = useScrollPagination(getDatasetCollectionTags, { pageSize: 10, - defaultParams: { + params: { datasetId: datasetDetail._id, - searchText: '' - } + searchText + }, + refreshDeps: [searchText], + EmptyTip: }); // Collections list - const { - scrollDataList: collectionsList, - ScrollList: ScrollListCollections, - isLoading: collectionsListLoading - } = useVirtualScrollPagination(getDatasetCollections, { - refreshDeps: [searchText], - // debounceWait: 300, - - itemHeight: 37, - overscan: 10, - - pageSize: 30, - defaultParams: { - datasetId: datasetDetail._id, - simple: true, - searchText + const { data: collectionsList, ScrollData: ScrollDataCollections } = useScrollPagination( + getDatasetCollections, + { + pageSize: 30, + params: { + datasetId: datasetDetail._id, + simple: true, + searchText + }, + refreshDeps: [searchText], + EmptyTip: } - }); + ); const { data: tagUsages } = useRequest2(() => getTagUsage(datasetDetail._id), { manual: false, refreshDeps: [collections] }); - const isLoading = - isRequesting || - isCreateCollectionTagLoading || - isDeleteCollectionTagLoading || - isUpdateCollectionTagLoading || - isSaveCollectionTagLoading || - collectionsListLoading; - return ( void }) => { w={'580px'} h={'600px'} closeOnOverlayClick={false} - isLoading={isLoading} > {currentAddTag === undefined ? ( <> @@ -205,6 +182,15 @@ const TagManageModal = ({ onClose }: { onClose: () => void }) => { total: tagsTotal })} + { + setSearchText(e.target.value); + }} + /> - } - > + {formatCollections.map((collection) => { return ( ); })} - + ); };