fix: do not call models watch after first loading

This commit is contained in:
jialin
2025-03-14 16:43:36 +08:00
parent b47b99bd28
commit ccbc36f991
+6 -2
View File
@@ -277,6 +277,7 @@ const Models: React.FC = () => {
); );
useEffect(() => { useEffect(() => {
let timer: any = null;
// fetch data first time // fetch data first time
const getTableData = async (loadingVal?: boolean) => { const getTableData = async (loadingVal?: boolean) => {
axiosToken?.cancel?.(); axiosToken?.cancel?.();
@@ -364,12 +365,15 @@ const Models: React.FC = () => {
setWorkerList(workerRes.items || []); setWorkerList(workerRes.items || []);
setCatalogList(cList); setCatalogList(cList);
setTimeout(() => { clearTimeout(timer);
timer = setTimeout(() => {
createModelsInstanceChunkRequest(); createModelsInstanceChunkRequest();
}, 500); createModelsChunkRequest();
}, 1000);
}; };
init(); init();
return () => { return () => {
clearTimeout(timer);
axiosToken?.cancel?.(); axiosToken?.cancel?.();
chunkRequedtRef.current?.current?.cancel?.(); chunkRequedtRef.current?.current?.cancel?.();
cacheDataListRef.current = []; cacheDataListRef.current = [];