From 50091ff23c1e769023acff5ede3f0981eff2d6cb Mon Sep 17 00:00:00 2001 From: lucyjemutai Date: Tue, 21 May 2024 16:44:40 +0300 Subject: [PATCH] address the pr comments --- packages/esm-commons-lib/src/api/api.ts | 3 +-- .../views/mch-summary/mch-summary.component.tsx | 2 +- .../tabs/current-pregnancy.component.tsx | 14 +++++++------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/esm-commons-lib/src/api/api.ts b/packages/esm-commons-lib/src/api/api.ts index 63ecc1321..73d17ef67 100644 --- a/packages/esm-commons-lib/src/api/api.ts +++ b/packages/esm-commons-lib/src/api/api.ts @@ -277,8 +277,7 @@ export async function fetchData( const response = await openmrsFetch(endpoint); const data = await response.json(); - - if (data && data.results && data.results.length > 0) { + if (data && data.results && data.results?.length) { const record = data.results[0].record; for (const item of record) { diff --git a/packages/esm-ohri-pmtct-app/src/views/mch-summary/mch-summary.component.tsx b/packages/esm-ohri-pmtct-app/src/views/mch-summary/mch-summary.component.tsx index 809adf959..02da5dc63 100644 --- a/packages/esm-ohri-pmtct-app/src/views/mch-summary/mch-summary.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/views/mch-summary/mch-summary.component.tsx @@ -27,7 +27,7 @@ const MaternalSummary: React.FC = ({ patientUuid }) => { setPtrackerId(pTrackerIdentifier.value); } } - }, [identifiersTypes.PTrackerIdentifierType, identifiersTypes.ptrackerIdentifierType, patient]); + }, [identifiersTypes.ptrackerIdentifierType, patient]); return ( <> diff --git a/packages/esm-ohri-pmtct-app/src/views/mch-summary/tabs/current-pregnancy.component.tsx b/packages/esm-ohri-pmtct-app/src/views/mch-summary/tabs/current-pregnancy.component.tsx index 224e8e947..facffa4f1 100644 --- a/packages/esm-ohri-pmtct-app/src/views/mch-summary/tabs/current-pregnancy.component.tsx +++ b/packages/esm-ohri-pmtct-app/src/views/mch-summary/tabs/current-pregnancy.component.tsx @@ -252,29 +252,29 @@ const CurrentPregnancy: React.FC = ({ patientUuid, pTrackerId { key: 'motherHIVStatus', header: t('motherHIVStatus', 'Mother HIV Status'), - encounterTypes: [encounterTypes.labourAndDelivery], - getObsValue: async ([encounter]) => { + encounterTypes: [], + getObsValue: async () => { return motherHivStatus; }, }, { key: 'expectedDeliveryDate', header: t('expectedDeliveryDate', 'Expected Delivery Date'), - encounterTypes: [encounterTypes.labourAndDelivery], - getObsValue: async ([encounter]) => { + encounterTypes: [], + getObsValue: async () => { return deliveryDate; }, }, { key: 'motherStatus', header: t('motherStatus', 'Mother Status'), - encounterTypes: [encounterTypes.labourAndDelivery], - getObsValue: async ([encounter]) => { + encounterTypes: [], + getObsValue: async () => { return motherStatus; }, }, ], - [motherStatus, deliveryDate], + [t, motherHivStatus, deliveryDate, motherStatus], ); const arvTherapyColumns: SummaryCardColumn[] = useMemo(