From 7487841385ecc53705440d2c73141e01b3c0b77c Mon Sep 17 00:00:00 2001 From: jialin Date: Mon, 20 Jan 2025 10:37:02 +0800 Subject: [PATCH] chore: save iconfont files locally --- .../seal-table/components/table-row.tsx | 7 +++---- src/pages/llmodels/index.tsx | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/components/seal-table/components/table-row.tsx b/src/components/seal-table/components/table-row.tsx index 67629d7a..40728b4f 100644 --- a/src/components/seal-table/components/table-row.tsx +++ b/src/components/seal-table/components/table-row.tsx @@ -111,11 +111,10 @@ const TableRow: React.FC< }; const filterUpdateChildrenHandler = () => { - _.each(tableContext.allChildren || [], (data: any) => { - if (_.get(data, ['data', [childParentKey]]) === _.get(record, [rowKey])) { - updateChunkedList(data); - } + const dataList = _.filter(tableContext.allChildren, (data: any) => { + return _.get(data, [childParentKey]) === _.get(record, [rowKey]); }); + setChildrenData(dataList); }; const updateChildrenHandler = (list: any) => { diff --git a/src/pages/llmodels/index.tsx b/src/pages/llmodels/index.tsx index 4fece67b..a81a2d98 100644 --- a/src/pages/llmodels/index.tsx +++ b/src/pages/llmodels/index.tsx @@ -59,6 +59,15 @@ const Models: React.FC = () => { } }); + const { + updateChunkedList: updateInstanceChunkedList, + cacheDataListRef: cacheInsDataListRef + } = useUpdateChunkedList({ + dataList: modelInstances, + limit: 100, + setDataList: setModelInstances + }); + const getWorkerList = async () => { try { const data = await queryWorkersList({ page: 1, perPage: 100 }); @@ -119,7 +128,9 @@ const Models: React.FC = () => { }; const updateInstanceHandler = (list: any) => { - setModelInstances(list); + _.each(list, (data: any) => { + updateInstanceChunkedList(data); + }); }; const createModelsChunkRequest = useCallback(async () => { @@ -155,6 +166,7 @@ const Models: React.FC = () => { isPageHidden.current = true; chunkRequedtRef.current?.current?.cancel?.(); cacheDataListRef.current = []; + cacheInsDataListRef.current = []; chunkInstanceRequedtRef.current?.current?.cancel?.(); }, []); @@ -212,6 +224,7 @@ const Models: React.FC = () => { return () => { chunkRequedtRef.current?.current?.cancel?.(); cacheDataListRef.current = []; + cacheInsDataListRef.current = []; chunkInstanceRequedtRef.current?.current?.cancel?.(); instancesToken.current?.cancel?.(); }; @@ -221,7 +234,6 @@ const Models: React.FC = () => { const handleVisibilityChange = async () => { if (document.visibilityState === 'visible') { isPageHidden.current = false; - // await fetchModelsInstances(); await Promise.all([ createModelsChunkRequest(), createModelsInstanceChunkRequest() @@ -231,6 +243,7 @@ const Models: React.FC = () => { isPageHidden.current = true; chunkRequedtRef.current?.current?.cancel?.(); cacheDataListRef.current = []; + cacheInsDataListRef.current = []; chunkInstanceRequedtRef.current?.current?.cancel?.(); } };