mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): simplify model install event listeners
This commit is contained in:
parent
4b106bc903
commit
f24d5e5e31
@ -15,13 +15,12 @@ export const addModelInstallEventListener = () => {
|
|||||||
|
|
||||||
dispatch(
|
dispatch(
|
||||||
modelsApi.util.updateQueryData('getModelImports', undefined, (draft) => {
|
modelsApi.util.updateQueryData('getModelImports', undefined, (draft) => {
|
||||||
const models = JSON.parse(JSON.stringify(draft))
|
const modelImport = draft.find((m) => m.id === id);
|
||||||
|
if (modelImport) {
|
||||||
const modelIndex = models.findIndex((m) => m.id === id);
|
modelImport.bytes = bytes;
|
||||||
|
modelImport.status = 'downloading';
|
||||||
models[modelIndex].bytes = bytes;
|
}
|
||||||
models[modelIndex].status = 'downloading';
|
return draft;
|
||||||
return models;
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -34,12 +33,11 @@ export const addModelInstallEventListener = () => {
|
|||||||
|
|
||||||
dispatch(
|
dispatch(
|
||||||
modelsApi.util.updateQueryData('getModelImports', undefined, (draft) => {
|
modelsApi.util.updateQueryData('getModelImports', undefined, (draft) => {
|
||||||
const models = JSON.parse(JSON.stringify(draft))
|
const modelImport = draft.find((m) => m.id === id);
|
||||||
|
if (modelImport) {
|
||||||
const modelIndex = models.findIndex((m) => m.id === id);
|
modelImport.status = 'completed';
|
||||||
|
}
|
||||||
models[modelIndex].status = 'completed';
|
return draft;
|
||||||
return models;
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -52,12 +50,11 @@ export const addModelInstallEventListener = () => {
|
|||||||
|
|
||||||
dispatch(
|
dispatch(
|
||||||
modelsApi.util.updateQueryData('getModelImports', undefined, (draft) => {
|
modelsApi.util.updateQueryData('getModelImports', undefined, (draft) => {
|
||||||
const models = JSON.parse(JSON.stringify(draft))
|
const modelImport = draft.find((m) => m.id === id);
|
||||||
|
if (modelImport) {
|
||||||
const modelIndex = models.findIndex((m) => m.id === id);
|
modelImport.status = 'error';
|
||||||
|
}
|
||||||
models[modelIndex].status = 'error';
|
return draft;
|
||||||
return models;
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user