Disable save button while submitting form in settings (#5352)
as per title
This commit is contained in:
@ -112,11 +112,12 @@ export const SettingsObjectNewFieldStep2 = () => {
|
||||
|
||||
if (!activeObjectMetadataItem) return null;
|
||||
|
||||
const canSave = formConfig.formState.isValid;
|
||||
|
||||
const handleSave = async () => {
|
||||
const formValues = formConfig.getValues();
|
||||
const canSave =
|
||||
formConfig.formState.isValid && !formConfig.formState.isSubmitting;
|
||||
|
||||
const handleSave = async (
|
||||
formValues: SettingsDataModelNewFieldFormValues,
|
||||
) => {
|
||||
try {
|
||||
if (
|
||||
formValues.type === FieldMetadataType.Relation &&
|
||||
@ -294,7 +295,7 @@ export const SettingsObjectNewFieldStep2 = () => {
|
||||
<SaveAndCancelButtons
|
||||
isSaveDisabled={!canSave}
|
||||
onCancel={() => navigate(`/settings/objects/${objectSlug}`)}
|
||||
onSave={handleSave}
|
||||
onSave={formConfig.handleSubmit(handleSave)}
|
||||
/>
|
||||
)}
|
||||
</SettingsHeaderContainer>
|
||||
|
||||
Reference in New Issue
Block a user