dengliming commented on code in PR #691:
URL: https://github.com/apache/shenyu-dashboard/pull/691#discussion_r4114165355


##########
src/models/mcpServer.js:
##########
@@ -1,96 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import { message } from "antd";
-import {
-  fetchMcpServer,
-  addMcpServer,
-  updateMcpServer,
-  deleteMcpServer,
-  mcpSwaggerImport,
-} from "../services/api";
-import { getIntlContent } from "../utils/IntlUtils";
+import { mcpSwaggerImport } from "../services/api";
 
 export default {
   namespace: "mcpServer",
 
-  state: {
-    list: [],
-    total: 0,
-    currentPage: 1,
-    pageSize: 12,
-  },
-
   effects: {
-    *fetch({ payload }, { call, put }) {
-      const response = yield call(fetchMcpServer, payload);
-      if (response) {
-        yield put({
-          type: "saveList",
-          payload: {
-            list: response.data,
-            total: response.total,
-            currentPage: payload.currentPage,
-            pageSize: payload.pageSize,
-          },
-        });
-      }
-    },
-    *add({ payload, callback }, { call, put }) {
-      const response = yield call(addMcpServer, payload);
-      if (response) {
-        message.success(getIntlContent("SHENYU.COMMON.RESPONSE.ADD.SUCCESS"));
-        yield put({ type: "reload" });
-      }
-      if (callback) callback();
-    },
-    *update({ payload, callback }, { call, put }) {
-      const response = yield call(updateMcpServer, payload);
-      if (response) {
-        message.success(
-          getIntlContent("SHENYU.COMMON.RESPONSE.UPDATE.SUCCESS"),
-        );
-        yield put({ type: "reload" });
-      }
-      if (callback) callback();
-    },
-    *delete({ payload, callback }, { call, put }) {
-      const response = yield call(deleteMcpServer, payload);
-      if (response) {
-        message.success(
-          getIntlContent("SHENYU.COMMON.RESPONSE.DELETE.SUCCESS"),
-        );
-        yield put({ type: "reload" });
-      }
-      if (callback) callback();
-    },
-    *reload(_, { put, select }) {
-      const { currentPage, pageSize } = yield select(
-        (state) => state.mcpServer,
-      );
-      yield put({
-        type: "fetch",
-        payload: { currentPage, pageSize },
-      });
-    },
-    *swaggerImport({ payload, callback }, { call, put }) {
+    *swaggerImport({ payload, fetchValue, callback }, { call, put }) {
       const json = yield call(mcpSwaggerImport, payload);
       if (json.code === 200) {
         message.success(json.message);
-        yield put({ type: "reload" });
+        yield put({
+          type: "common/fetchSelector",

Review Comment:
   [P2] Align tool pagination with the post-import refresh
   
   `common/fetchSelector` also selects the first returned server and dispatches 
`fetchRule` with `currentPage: 1, pageSize: 12`. However, this import callback 
only closes the modal, leaving the MCP component's `toolPage` and 
`toolPageSize` unchanged. For example, importing while the tools table is on 
page 3 with 50 rows per page loads page 1 with 12 rows, while the visible pager 
still says page 3 / 50 rows. This makes the displayed page and subsequent 
navigation inconsistent.
   
   I reproduced this by running the actual import and common selector effects 
from a component with `toolPage = 3` and `toolPageSize = 50`. Please 
synchronize the component pagination and the rule query during the refresh, 
including both the page number and page size, and add a regression test 
starting from a non-default tool page/size. The selector-row click reset in 
#690 does not cover this import path.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to