fix: delay in updating model list
This commit is contained in:
@@ -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=====', {
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
Reference in New Issue
Block a user