mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: Filter document by running status and file type. #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { useHandleFilterSubmit } from '@/components/list-filter-bar/use-handle-filter-submit';
|
||||
import {
|
||||
IKnowledge,
|
||||
IKnowledgeResult,
|
||||
@ -72,8 +73,8 @@ export const useTestRetrieval = () => {
|
||||
export const useFetchNextKnowledgeListByPage = () => {
|
||||
const { searchString, handleInputChange } = useHandleSearchChange();
|
||||
const { pagination, setPagination } = useGetPaginationWithRouter();
|
||||
const [ownerIds, setOwnerIds] = useState<string[]>([]);
|
||||
const debouncedSearchString = useDebounce(searchString, { wait: 500 });
|
||||
const { filterValue, handleFilterSubmit } = useHandleFilterSubmit();
|
||||
|
||||
const { data, isFetching: loading } = useQuery<IKnowledgeResult>({
|
||||
queryKey: [
|
||||
@ -81,7 +82,7 @@ export const useFetchNextKnowledgeListByPage = () => {
|
||||
{
|
||||
debouncedSearchString,
|
||||
...pagination,
|
||||
ownerIds,
|
||||
filterValue,
|
||||
},
|
||||
],
|
||||
initialData: {
|
||||
@ -97,7 +98,7 @@ export const useFetchNextKnowledgeListByPage = () => {
|
||||
page: pagination.current,
|
||||
},
|
||||
{
|
||||
owner_ids: ownerIds,
|
||||
owner_ids: filterValue.owner,
|
||||
},
|
||||
);
|
||||
|
||||
@ -113,11 +114,6 @@ export const useFetchNextKnowledgeListByPage = () => {
|
||||
[handleInputChange],
|
||||
);
|
||||
|
||||
const handleOwnerIdsChange = useCallback((ids: string[]) => {
|
||||
// setPagination({ page: 1 }); // TODO: 这里导致重复请求
|
||||
setOwnerIds(ids);
|
||||
}, []);
|
||||
|
||||
return {
|
||||
...data,
|
||||
searchString,
|
||||
@ -125,8 +121,8 @@ export const useFetchNextKnowledgeListByPage = () => {
|
||||
pagination: { ...pagination, total: data?.total },
|
||||
setPagination,
|
||||
loading,
|
||||
setOwnerIds: handleOwnerIdsChange,
|
||||
ownerIds,
|
||||
filterValue,
|
||||
handleFilterSubmit,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user