fix: delay in updating model list
This commit is contained in:
@@ -27,10 +27,11 @@ export function useUpdateChunkedList(options: {
|
|||||||
}, [options.dataList]);
|
}, [options.dataList]);
|
||||||
|
|
||||||
const debounceUpdateChunckedList = () => {
|
const debounceUpdateChunckedList = () => {
|
||||||
clearTimeout(timerRef.current);
|
// clearTimeout(timerRef.current);
|
||||||
timerRef.current = setTimeout(() => {
|
// timerRef.current = setTimeout(() => {
|
||||||
options.setDataList?.([...cacheDataListRef.current]);
|
// options.setDataList?.([...cacheDataListRef.current]);
|
||||||
}, 80);
|
// }, 80);
|
||||||
|
options.setDataList?.([...cacheDataListRef.current]);
|
||||||
};
|
};
|
||||||
const updateChunkedList = (data: ChunkedCollection) => {
|
const updateChunkedList = (data: ChunkedCollection) => {
|
||||||
console.log('updateChunkedList=====', {
|
console.log('updateChunkedList=====', {
|
||||||
|
|||||||
@@ -406,9 +406,6 @@ const Models: React.FC<ModelsProps> = ({
|
|||||||
name: row.name,
|
name: row.name,
|
||||||
async onOk() {
|
async onOk() {
|
||||||
await deleteModelInstance(row.id);
|
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, {
|
const res: any = await queryModelsList(params, {
|
||||||
cancelToken: axiosToken.token
|
cancelToken: axiosToken.token
|
||||||
});
|
});
|
||||||
if (!firstLoad) {
|
|
||||||
setDataSource({
|
setDataSource({
|
||||||
dataList: res.items || [],
|
dataList: res.items || [],
|
||||||
loading: false,
|
loading: false,
|
||||||
total: res.pagination.total
|
total: res.pagination.total
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
setDataSource({
|
|
||||||
...dataSource,
|
|
||||||
loading: !!res.items.length,
|
|
||||||
total: res.pagination.total
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setDataSource({
|
setDataSource({
|
||||||
dataList: [],
|
dataList: [],
|
||||||
|
|||||||
Reference in New Issue
Block a user