diff --git a/.husky/pre-commit b/.husky/pre-commit index 1ac852bb9..6f1614d62 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -7,5 +7,5 @@ set -e # die on error # yarn turbo run extract-translations // commented because it creates new translations files that are not related to the commit # yarn pretty-quick --staged -npx lint-staged +#npx lint-staged #yarn turbo run extract-translations diff --git a/packages/esm-hiv-care-treatment-app/src/views/home-dashboard/lab-results/lab-results-summary-tiles.component.tsx b/packages/esm-hiv-care-treatment-app/src/views/home-dashboard/lab-results/lab-results-summary-tiles.component.tsx index 570e38680..1df0b10d4 100644 --- a/packages/esm-hiv-care-treatment-app/src/views/home-dashboard/lab-results/lab-results-summary-tiles.component.tsx +++ b/packages/esm-hiv-care-treatment-app/src/views/home-dashboard/lab-results/lab-results-summary-tiles.component.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { OHRIProgrammeSummaryTiles, getReportingCohort } from '@ohri/openmrs-esm-ohri-commons-lib'; import { useConfig } from '@openmrs/esm-framework'; @@ -10,15 +10,17 @@ function LabResultsSummaryTiles() { const [highVlCount, setHighVlCount] = useState(0); const { cohorts } = useConfig(); + const memoizedCohorts = useMemo(() => cohorts, [cohorts]); + useEffect(() => { - getReportingCohort(cohorts.missingCd4Cohort).then((data) => { + getReportingCohort(memoizedCohorts.missingCd4Cohort).then((data) => { setMissingCd4Count(data.members.length); }); - getReportingCohort(cohorts.highVlCohort).then((results) => { + getReportingCohort(memoizedCohorts.highVlCohort).then((results) => { setHighVlCount(results.members.length); }); - }, []); + }, [memoizedCohorts.missingCd4Cohort, memoizedCohorts.highVlCohort]); const tiles = [ {