From 0c7d2f9beb22fde9dc3b5dfb526d155602e012e7 Mon Sep 17 00:00:00 2001 From: Tony Valle Date: Fri, 20 Oct 2023 22:26:43 +0200 Subject: [PATCH] fix: avoid dispatching if `orgUnitId` is undefined --- .../metadataRetrieval/coreOrgUnit/useCoreOrgUnit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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,