From e92ac40694155900e2fea498e901dc5894e93144 Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Mon, 19 May 2025 15:56:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=97=E8=A1=A8=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=97=B6=E9=95=BF=E5=92=8C=E8=AF=A6=E6=83=85=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=97=B6=E9=95=BF=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ExperimentList/index.tsx | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/react-ui/src/pages/AutoML/components/ExperimentList/index.tsx b/react-ui/src/pages/AutoML/components/ExperimentList/index.tsx index 6f944ac7..54eb4385 100644 --- a/react-ui/src/pages/AutoML/components/ExperimentList/index.tsx +++ b/react-ui/src/pages/AutoML/components/ExperimentList/index.tsx @@ -63,20 +63,23 @@ function ExperimentList({ type }: ExperimentListProps) { const timerRef = useRef | undefined>(); // 获取自主机器学习或超参数自动优化列表 - const getAutoMLList = useCallback(async () => { - const params: Record = { - page: pagination.current! - 1, - size: pagination.pageSize, - [config.nameProperty]: searchText || undefined, - }; - const request = config.getListReq; - const [res] = await to(request(params)); - if (res && res.data) { - const { content = [], totalElements = 0 } = res.data; - setTableData(content); - setTotal(totalElements); - } - }, [pagination, searchText, config]); + const getAutoMLList = useCallback( + async (skipLoading: boolean = false) => { + const params: Record = { + page: pagination.current! - 1, + size: pagination.pageSize, + [config.nameProperty]: searchText || undefined, + }; + const request = config.getListReq; + const [res] = await to(request(params, skipLoading)); + if (res && res.data) { + const { content = [], totalElements = 0 } = res.data; + setTableData(content); + setTotal(totalElements); + } + }, + [pagination, searchText, config], + ); useEffect(() => { getAutoMLList(); @@ -111,9 +114,12 @@ function ExperimentList({ type }: ExperimentListProps) { // 刷新实验列表状态, // TODO: 目前是直接刷新实验列表,后续需要优化,只刷新状态 - const refreshExperimentList = useCallback(() => { - getAutoMLList(); - }, [getAutoMLList]); + const refreshExperimentList = useCallback( + (skipLoading: boolean = false) => { + getAutoMLList(skipLoading); + }, + [getAutoMLList], + ); // 刷新实验实例列表 const refreshExperimentIns = useCallback( @@ -150,7 +156,7 @@ function ExperimentList({ type }: ExperimentListProps) { } timerRef.current = setTimeout(() => { - refreshExperimentList(); + refreshExperimentList(true); }, 10000); } };