diff --git a/source/frontend/src/features/mapSideBar/acquisition/AcquisitionContainer.tsx b/source/frontend/src/features/mapSideBar/acquisition/AcquisitionContainer.tsx index b7e4d98be2..63ab0f8fd2 100644 --- a/source/frontend/src/features/mapSideBar/acquisition/AcquisitionContainer.tsx +++ b/source/frontend/src/features/mapSideBar/acquisition/AcquisitionContainer.tsx @@ -303,8 +303,8 @@ export const AcquisitionContainer: React.FunctionComponent { - onSuccess(); + .then(async response => { + await onSuccess(); if (isValidId(response?.id)) { pathGenerator.showFile('acquisition', response.id); } diff --git a/source/frontend/src/features/mapSideBar/research/ResearchContainer.tsx b/source/frontend/src/features/mapSideBar/research/ResearchContainer.tsx index 9e18c4c85d..e7e254e121 100644 --- a/source/frontend/src/features/mapSideBar/research/ResearchContainer.tsx +++ b/source/frontend/src/features/mapSideBar/research/ResearchContainer.tsx @@ -238,8 +238,8 @@ export const ResearchContainer: React.FunctionComponent return updateResearchFileProperties( file as ApiGen_Concepts_ResearchFile, userOverrideCodes, - ).then(response => { - onSuccess(); + ).then(async response => { + await onSuccess(); if (isValidId(response?.id)) { pathGenerator.showFile('research', response.id); } diff --git a/source/frontend/src/features/mapSideBar/shared/update/properties/UpdateProperties.test.tsx b/source/frontend/src/features/mapSideBar/shared/update/properties/UpdateProperties.test.tsx index 9e5aaa53b2..7133c27e5b 100644 --- a/source/frontend/src/features/mapSideBar/shared/update/properties/UpdateProperties.test.tsx +++ b/source/frontend/src/features/mapSideBar/shared/update/properties/UpdateProperties.test.tsx @@ -360,7 +360,7 @@ describe('UpdateProperties component', () => { ); }); - it('if the update fails with a 409 the associated entities modal is displayed', async () => { + it('if the update fails with a 409 it does not show the associated entities modal', async () => { updateFileProperties.mockRejectedValue({ isAxiosError: true, code: '409', @@ -373,8 +373,10 @@ describe('UpdateProperties component', () => { await act(async () => userEvent.click(saveConfirmButton)); expect(updateFileProperties).toHaveBeenCalled(); - expect(screen.getByText('Property with associations')); - expect(screen.getByText(/This property can not be removed from the file/i)); + expect(screen.queryByText('Property with associations')).not.toBeInTheDocument(); + expect( + screen.queryByText(/This property can not be removed from the file/i), + ).not.toBeInTheDocument(); }); it('validates form values upon submission', async () => { diff --git a/source/frontend/src/features/mapSideBar/shared/update/properties/UpdateProperties.tsx b/source/frontend/src/features/mapSideBar/shared/update/properties/UpdateProperties.tsx index 4db49cc72f..a26571b8c8 100644 --- a/source/frontend/src/features/mapSideBar/shared/update/properties/UpdateProperties.tsx +++ b/source/frontend/src/features/mapSideBar/shared/update/properties/UpdateProperties.tsx @@ -175,7 +175,6 @@ export const UpdateProperties: React.FunctionComponent = try { const response = await props.updateFileProperties(file, []); - formikRef.current?.setSubmitting(false); if (isValidId(response?.id)) { if (file.fileProperties?.find(fp => !fp.property?.address && !fp.property?.id)) { toast.warn( @@ -189,8 +188,10 @@ export const UpdateProperties: React.FunctionComponent = } } catch (e) { if (axios.isAxiosError(e) && (e as AxiosError).code === '409') { - setShowAssociatedEntityWarning(true); + return; } + } finally { + formikRef.current?.setSubmitting(false); } };