diff --git a/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/CheckpointModelEdit.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/CheckpointModelEdit.tsx index c8b86cbd68..629f01e8fd 100644 --- a/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/CheckpointModelEdit.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/CheckpointModelEdit.tsx @@ -74,27 +74,30 @@ export default function CheckpointModelEdit(props: CheckpointModelEditProps) { model_name: retrievedModel.model_name, body: values, }; - updateMainModel(responseBody); - - if (error) { - dispatch( - addToast( - makeToast({ - title: t('modelManager.modelUpdateFailed'), - status: 'success', - }) - ) - ); - } - - dispatch( - addToast( - makeToast({ - title: t('modelManager.modelUpdated'), - status: 'success', - }) - ) - ); + updateMainModel(responseBody) + .unwrap() + .then((payload) => { + checkpointEditForm.setValues(payload as CheckpointModelConfig); + dispatch( + addToast( + makeToast({ + title: t('modelManager.modelUpdated'), + status: 'success', + }) + ) + ); + }) + .catch((error) => { + checkpointEditForm.reset(); + dispatch( + addToast( + makeToast({ + title: t('modelManager.modelUpdateFailed'), + status: 'error', + }) + ) + ); + }); }; return modelToEdit ? ( diff --git a/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/DiffusersModelEdit.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/DiffusersModelEdit.tsx index c073d10817..0bf3d87838 100644 --- a/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/DiffusersModelEdit.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/DiffusersModelEdit.tsx @@ -71,27 +71,30 @@ export default function DiffusersModelEdit(props: DiffusersModelEditProps) { model_name: retrievedModel.model_name, body: values, }; - updateMainModel(responseBody); - - if (error) { - dispatch( - addToast( - makeToast({ - title: t('modelManager.modelUpdateFailed'), - status: 'error', - }) - ) - ); - } - - dispatch( - addToast( - makeToast({ - title: t('modelManager.modelUpdated'), - status: 'success', - }) - ) - ); + updateMainModel(responseBody) + .unwrap() + .then((payload) => { + diffusersEditForm.setValues(payload as DiffusersModelConfig); + dispatch( + addToast( + makeToast({ + title: t('modelManager.modelUpdated'), + status: 'success', + }) + ) + ); + }) + .catch((error) => { + diffusersEditForm.reset(); + dispatch( + addToast( + makeToast({ + title: t('modelManager.modelUpdateFailed'), + status: 'error', + }) + ) + ); + }); }; return modelToEdit ? (