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