mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-04 23:00:30 +08:00
Fix: go back to previous page when last card on the last page is deleted (#17409)
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';
|
||||
import { useGoToPreviousPageOnEmpty } from '@/hooks/logic-hooks';
|
||||
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
|
||||
import { useFetchAgentListByPage } from '@/hooks/use-agent-request';
|
||||
import { useDeleteCompilationTemplateGroup } from '@/hooks/use-compilation-template-group-request';
|
||||
@@ -82,6 +83,7 @@ export default function Agents() {
|
||||
},
|
||||
[setPagination],
|
||||
);
|
||||
useGoToPreviousPageOnEmpty(data?.length, listLoading);
|
||||
|
||||
const handleEditCompilation = useCallback(
|
||||
(id: string) => () => {
|
||||
|
||||
@@ -6,6 +6,7 @@ import { RenameDialog } from '@/components/rename-dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';
|
||||
import { Spin } from '@/components/ui/spin';
|
||||
import { useGoToPreviousPageOnEmpty } from '@/hooks/logic-hooks';
|
||||
import { useFetchNextKnowledgeListByPage } from '@/hooks/use-knowledge-request';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { pick } from 'lodash';
|
||||
@@ -58,6 +59,7 @@ export default function Datasets() {
|
||||
},
|
||||
[setPagination],
|
||||
);
|
||||
useGoToPreviousPageOnEmpty(kbs?.length, loading);
|
||||
const [searchUrl, setSearchUrl] = useSearchParams();
|
||||
const isCreate = searchUrl.get('isCreate') === 'true';
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
@@ -5,6 +5,7 @@ import ListFilterBar from '@/components/list-filter-bar';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useGoToPreviousPageOnEmpty } from '@/hooks/logic-hooks';
|
||||
import { pick } from 'lodash';
|
||||
import { Plus } from 'lucide-react';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
@@ -22,6 +23,7 @@ export default function MemoryList() {
|
||||
// const [isEdit, setIsEdit] = useState(false);
|
||||
const {
|
||||
data: list,
|
||||
isLoading,
|
||||
pagination,
|
||||
searchString,
|
||||
handleInputChange,
|
||||
@@ -56,6 +58,7 @@ export default function MemoryList() {
|
||||
},
|
||||
[setPagination],
|
||||
);
|
||||
useGoToPreviousPageOnEmpty(list?.data?.memory_list?.length, isLoading);
|
||||
|
||||
const [searchUrl, setMemoryUrl] = useSearchParams();
|
||||
const { filters } = useSelectFilters();
|
||||
|
||||
@@ -6,6 +6,7 @@ import { RenameDialog } from '@/components/rename-dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';
|
||||
import { Spin } from '@/components/ui/spin';
|
||||
import { useGoToPreviousPageOnEmpty } from '@/hooks/logic-hooks';
|
||||
import { useFetchChatList } from '@/hooks/use-chat-request';
|
||||
import { buildOwnersFilter } from '@/utils/list-filter-util';
|
||||
import { pick } from 'lodash';
|
||||
@@ -53,6 +54,7 @@ export default function ChatList() {
|
||||
},
|
||||
[setPagination],
|
||||
);
|
||||
useGoToPreviousPageOnEmpty(data?.chats?.length, loading);
|
||||
|
||||
const handleShowCreateModal = useCallback(() => {
|
||||
showCreateChatModal();
|
||||
|
||||
@@ -6,6 +6,7 @@ import { RenameDialog } from '@/components/rename-dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useGoToPreviousPageOnEmpty } from '@/hooks/logic-hooks';
|
||||
import { buildOwnersFilter } from '@/utils/list-filter-util';
|
||||
import { pick } from 'lodash';
|
||||
import { Plus } from 'lucide-react';
|
||||
@@ -21,6 +22,7 @@ export default function SearchList() {
|
||||
// const [isEdit, setIsEdit] = useState(false);
|
||||
const {
|
||||
data: list,
|
||||
isLoading,
|
||||
pagination,
|
||||
searchString,
|
||||
handleInputChange,
|
||||
@@ -59,6 +61,7 @@ export default function SearchList() {
|
||||
},
|
||||
[setPagination],
|
||||
);
|
||||
useGoToPreviousPageOnEmpty(list?.data?.search_apps?.length, isLoading);
|
||||
|
||||
const [searchUrl, setSearchUrl] = useSearchParams();
|
||||
const isCreate = searchUrl.get('isCreate') === 'true';
|
||||
|
||||
Reference in New Issue
Block a user