Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: On the MCP list page, if the only record on the last page is deleted, the view should navigate to the previous page. (#18840)

balibabu20c92b41388e
diff --git a/web/src/pages/user-setting/mcp/index.tsx b/web/src/pages/user-setting/mcp/index.tsx
index 969665ad70..575676a65e 100644
--- a/web/src/pages/user-setting/mcp/index.tsx
+++ b/web/src/pages/user-setting/mcp/index.tsx
@@ -24,6 +24,7 @@ import { Checkbox } from '@/components/ui/checkbox';
import { SearchInput } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';
+import { useGoToPreviousPageOnEmpty } from '@/hooks/logic-hooks';
import { useListMcpServer } from '@/hooks/use-mcp-request';
import { pick } from 'lodash';
import {
@@ -45,8 +46,15 @@ import { useEditMcp } from './use-edit-mcp';
import { useImportMcp } from './use-import-mcp';
export default function McpServer() {
- const { data, setPagination, searchString, handleInputChange, pagination } =
- useListMcpServer();
+ const {
+ data,
+ setPagination,
+ searchString,
+ handleInputChange,
+ pagination,
+ loading: listLoading,
+ } = useListMcpServer();
+ useGoToPreviousPageOnEmpty(data.mcp_servers?.length, listLoading);
const { editVisible, showEditModal, hideEditModal, handleOk, id, loading } =
useEditMcp();
const {