diff --git a/client/src/components/Project/ProjectDonorsHeader/ProjectDonorsHeader.tsx b/client/src/components/Project/ProjectDonorsHeader/ProjectDonorsHeader.tsx index 47b84ad019..f8375c38c3 100644 --- a/client/src/components/Project/ProjectDonorsHeader/ProjectDonorsHeader.tsx +++ b/client/src/components/Project/ProjectDonorsHeader/ProjectDonorsHeader.tsx @@ -1,5 +1,5 @@ import cx from 'classnames'; -import React, { FC } from 'react'; +import React, { FC, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router-dom'; @@ -24,11 +24,19 @@ const ProjectDonorsHeader: FC = ({ projectAddress, epochNumber === currentEpoch ? undefined : epochNumber, ); + + const numberOfDonors = useMemo(() => { + if (epochNumber === currentEpoch) { + return 0; + } + return isFetching ? '--' : projectDonors?.length; + }, [isFetching, projectDonors, epochNumber, currentEpoch]); + return (
{i18n.t('common.donors')}{' '}
- {isFetching ? '--' : projectDonors?.length} + {numberOfDonors}
);