diff --git a/src/core_modules/capture-core/metadataRetrieval/coreOrgUnit/useCoreOrgUnit.js b/src/core_modules/capture-core/metadataRetrieval/coreOrgUnit/useCoreOrgUnit.js index b30c3a36c3..ef63a442b2 100644 --- a/src/core_modules/capture-core/metadataRetrieval/coreOrgUnit/useCoreOrgUnit.js +++ b/src/core_modules/capture-core/metadataRetrieval/coreOrgUnit/useCoreOrgUnit.js @@ -28,7 +28,7 @@ export function useCoreOrgUnit(orgUnitId: string): { return { error: { groupError, errorComponent } }; } - if (orgUnit && orgUnitGroups) { + if (orgUnitId && orgUnit && orgUnitGroups) { const { displayName, ...restOrgUnit } = orgUnit; const coreOrgUnit = { ...restOrgUnit,