fix: model instances always update by cache
This commit is contained in:
@@ -136,9 +136,6 @@ const TableRow: React.FC<
|
|||||||
}, [record, loadChildren]);
|
}, [record, loadChildren]);
|
||||||
|
|
||||||
const filterUpdateChildrenHandler = () => {
|
const filterUpdateChildrenHandler = () => {
|
||||||
if (!expandedRowKeys?.includes(record[rowKey])) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const dataList = _.filter(tableContext.allChildren, (data: any) => {
|
const dataList = _.filter(tableContext.allChildren, (data: any) => {
|
||||||
return _.get(data, [childParentKey]) === _.get(record, [rowKey]);
|
return _.get(data, [childParentKey]) === _.get(record, [rowKey]);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -503,7 +503,14 @@ const Models: React.FC<ModelsProps> = ({
|
|||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[handleEdit, handleOpenPlayGround, handleDelete, expandedRowKeys]
|
[
|
||||||
|
handleEdit,
|
||||||
|
handleOpenPlayGround,
|
||||||
|
handleDelete,
|
||||||
|
onStop,
|
||||||
|
onStart,
|
||||||
|
expandedRowKeys
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleChildSelect = useCallback(
|
const handleChildSelect = useCallback(
|
||||||
|
|||||||
@@ -252,24 +252,14 @@ const Models: React.FC = () => {
|
|||||||
});
|
});
|
||||||
}, [fetchData, createModelsChunkRequest, createModelsInstanceChunkRequest]);
|
}, [fetchData, createModelsChunkRequest, createModelsInstanceChunkRequest]);
|
||||||
|
|
||||||
const handleOnStop = useCallback(async (ids: number[]) => {
|
const handleSearchBySilent = useCallback(async () => {
|
||||||
cacheInsDataListRef.current = cacheInsDataListRef.current.filter(
|
|
||||||
(item: any) => !ids.includes(item.model_id)
|
|
||||||
);
|
|
||||||
await new Promise((resolve) => {
|
await new Promise((resolve) => {
|
||||||
setTimeout(resolve, 300);
|
setTimeout(resolve, 300);
|
||||||
});
|
});
|
||||||
setModelInstances(cacheInsDataListRef.current);
|
|
||||||
fetchData({
|
fetchData({
|
||||||
loadingVal: false
|
loadingVal: false
|
||||||
});
|
});
|
||||||
}, []);
|
}, [fetchData]);
|
||||||
|
|
||||||
const handleOnStart = useCallback(() => {
|
|
||||||
fetchData({
|
|
||||||
loadingVal: false
|
|
||||||
});
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const handleSearch = useCallback(
|
const handleSearch = useCallback(
|
||||||
async (params?: any) => {
|
async (params?: any) => {
|
||||||
@@ -480,8 +470,8 @@ const Models: React.FC = () => {
|
|||||||
handleOnToggleExpandAll={createModelsInstanceChunkRequest}
|
handleOnToggleExpandAll={createModelsInstanceChunkRequest}
|
||||||
onViewLogs={handleOnViewLogs}
|
onViewLogs={handleOnViewLogs}
|
||||||
onCancelViewLogs={handleOnCancelViewLogs}
|
onCancelViewLogs={handleOnCancelViewLogs}
|
||||||
onStop={handleOnStop}
|
onStop={handleSearchBySilent}
|
||||||
onStart={handleOnStart}
|
onStart={handleSearchBySilent}
|
||||||
queryParams={queryParams}
|
queryParams={queryParams}
|
||||||
loading={dataSource.loading}
|
loading={dataSource.loading}
|
||||||
loadend={dataSource.loadend}
|
loadend={dataSource.loadend}
|
||||||
|
|||||||
Reference in New Issue
Block a user