Skip to content

Commit

Permalink
fix: delay in updating model list
Browse files Browse the repository at this point in the history
  • Loading branch information
hibig committed Dec 12, 2024
1 parent dde746a commit 85949c5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
9 changes: 5 additions & 4 deletions src/hooks/use-update-chunk-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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=====', {
Expand Down
3 changes: 0 additions & 3 deletions src/pages/llmodels/components/table-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,6 @@ const Models: React.FC<ModelsProps> = ({
name: row.name,
async onOk() {
await deleteModelInstance(row.id);
if (list.length === 1) {
removeExpandedRowKey([row.model_id]);
}
}
});
};
Expand Down
19 changes: 6 additions & 13 deletions src/pages/llmodels/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
Expand Down

0 comments on commit 85949c5

Please sign in to comment.