Skip to content

Commit

Permalink
Force submitting flag to be true in the case of user override. (#4361)
Browse files Browse the repository at this point in the history
Co-authored-by: Alejandro Sanchez <emailforasr@gmail.com>
  • Loading branch information
devinleighsmith and asanchezr authored Sep 24, 2024
1 parent 42a84f9 commit 20c1c6c
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,19 @@ export function useAddProjectForm(props: IUseAddProjectFormProps) {
formikHelpers: FormikHelpers<ProjectForm>,
userOverrideCodes: UserOverrideCode[],
) => {
const project = values.toApi();
const response = await addProject.execute(project, userOverrideCodes);

if (exists(response) && isValidId(response?.id)) {
formikHelpers.resetForm();
if (typeof onSuccess === 'function') {
onSuccess(response);
formikHelpers.setSubmitting(true);
try {
const project = values.toApi();
const response = await addProject.execute(project, userOverrideCodes);

if (exists(response) && isValidId(response?.id)) {
formikHelpers.resetForm();
if (typeof onSuccess === 'function') {
onSuccess(response);
}
}
} finally {
formikHelpers.setSubmitting(false);
}
},
[addProject, onSuccess],
Expand Down

0 comments on commit 20c1c6c

Please sign in to comment.