diff --git a/frontend/components/organisation/units/ResearchUnitModal.tsx b/frontend/components/organisation/units/ResearchUnitModal.tsx index b2c85dff4..8dd53d866 100644 --- a/frontend/components/organisation/units/ResearchUnitModal.tsx +++ b/frontend/components/organisation/units/ResearchUnitModal.tsx @@ -56,7 +56,7 @@ export default function EditOrganisationModal({ const {isValid, isDirty, errors} = formState const formData = watch() - useEffect(() => { + useEffect(() => { if (typeof location != 'undefined') { const baseUrl = location.href.split('?') // baseUrl is current location without params diff --git a/frontend/components/organisation/units/index.tsx b/frontend/components/organisation/units/index.tsx index ad997fee7..e3369e0cd 100644 --- a/frontend/components/organisation/units/index.tsx +++ b/frontend/components/organisation/units/index.tsx @@ -32,7 +32,7 @@ type EditOrganisationModal = { export default function ResearchUnits({organisation}: OrganisationComponentsProps) { const {token,user} = useSession() const {showErrorMessage} = useSnackbar() - const {units, setUnits,loading} = useOrganisationUnits({ + const {units, setUnits, loading} = useOrganisationUnits({ organisation: organisation.id, token }) @@ -116,7 +116,6 @@ export default function ResearchUnits({organisation}: OrganisationComponentsProp async function saveOrganisation({data, pos}:{data: EditOrganisation, pos?: number }) { try { - closeModals() if (typeof pos != 'undefined' && data.id) { // update existing organisation const resp = await updateOrganisation({ @@ -135,6 +134,7 @@ export default function ResearchUnits({organisation}: OrganisationComponentsProp } else { updateUnitInList(data,pos) } + closeModals() } } else { // create new organisation @@ -148,6 +148,7 @@ export default function ResearchUnits({organisation}: OrganisationComponentsProp id: resp.message }) addUnitToCollection(newUnit) + closeModals() } else { showErrorMessage(resp.message) } diff --git a/frontend/components/projects/ProjectFunding.tsx b/frontend/components/projects/ProjectFunding.tsx index d42e96ff1..8b66c86b7 100644 --- a/frontend/components/projects/ProjectFunding.tsx +++ b/frontend/components/projects/ProjectFunding.tsx @@ -28,14 +28,14 @@ export default function ProjectFunding({grant_id, fundingOrganisations=[]}: