From 85949c5927119fe7a0eaec25d039c727dd909302 Mon Sep 17 00:00:00 2001 From: jialin Date: Thu, 12 Dec 2024 16:26:34 +0800 Subject: [PATCH] fix: delay in updating model list --- src/hooks/use-update-chunk-list.ts | 9 +++++---- src/pages/llmodels/components/table-list.tsx | 3 --- src/pages/llmodels/index.tsx | 19 ++++++------------- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/hooks/use-update-chunk-list.ts b/src/hooks/use-update-chunk-list.ts index 6979df92..074aed8c 100644 --- a/src/hooks/use-update-chunk-list.ts +++ b/src/hooks/use-update-chunk-list.ts @@ -27,10 +27,11 @@ export function useUpdateChunkedList(options: { }, [options.dataList]); const debounceUpdateChunckedList = () => { - clearTimeout(timerRef.current); - timerRef.current = setTimeout(() => { - options.setDataList?.([...cacheDataListRef.current]); - }, 80); + // clearTimeout(timerRef.current); + // timerRef.current = setTimeout(() => { + // options.setDataList?.([...cacheDataListRef.current]); + // }, 80); + options.setDataList?.([...cacheDataListRef.current]); }; const updateChunkedList = (data: ChunkedCollection) => { console.log('updateChunkedList=====', { diff --git a/src/pages/llmodels/components/table-list.tsx b/src/pages/llmodels/components/table-list.tsx index 725aba90..d8e6def1 100644 --- a/src/pages/llmodels/components/table-list.tsx +++ b/src/pages/llmodels/components/table-list.tsx @@ -406,9 +406,6 @@ const Models: React.FC = ({ name: row.name, async onOk() { await deleteModelInstance(row.id); - if (list.length === 1) { - removeExpandedRowKey([row.model_id]); - } } }); }; diff --git a/src/pages/llmodels/index.tsx b/src/pages/llmodels/index.tsx index 5cdcbdd4..ca3b3b1a 100644 --- a/src/pages/llmodels/index.tsx +++ b/src/pages/llmodels/index.tsx @@ -87,19 +87,12 @@ const Models: React.FC = () => { const res: any = await queryModelsList(params, { cancelToken: axiosToken.token }); - if (!firstLoad) { - setDataSource({ - dataList: res.items || [], - loading: false, - total: res.pagination.total - }); - } else { - setDataSource({ - ...dataSource, - loading: !!res.items.length, - total: res.pagination.total - }); - } + + setDataSource({ + dataList: res.items || [], + loading: false, + total: res.pagination.total + }); } catch (error) { setDataSource({ dataList: [],