Skip to content

Commit

Permalink
Contd Changes for ESLint react-hooks/exhaustive-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
nravilla committed Jun 12, 2024
1 parent 502779e commit 32b933b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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 = [
{
Expand Down

0 comments on commit 32b933b

Please sign in to comment.