fix: delay in updating model list
This commit is contained in:
@@ -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