mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): reset model edit form state with new values
Without this, the form will incorrectly compare its state to its initial default values to determine if it is dirty. Instead, it should reset its default values to the new values after successful submit.
This commit is contained in:
parent
6386109fc5
commit
773182f425
@ -43,7 +43,7 @@ export const DefaultSettingsForm = ({
|
||||
|
||||
const [updateModel, { isLoading }] = useUpdateModelMutation();
|
||||
|
||||
const { handleSubmit, control, formState } = useForm<DefaultSettingsFormData>({
|
||||
const { handleSubmit, control, formState, reset } = useForm<DefaultSettingsFormData>({
|
||||
defaultValues: defaultSettingsDefaults,
|
||||
});
|
||||
|
||||
@ -76,6 +76,7 @@ export const DefaultSettingsForm = ({
|
||||
})
|
||||
)
|
||||
);
|
||||
reset(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error) {
|
||||
@ -90,7 +91,7 @@ export const DefaultSettingsForm = ({
|
||||
}
|
||||
});
|
||||
},
|
||||
[selectedModelKey, dispatch, updateModel, t]
|
||||
[selectedModelKey, dispatch, reset, updateModel, t]
|
||||
);
|
||||
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user