diff --git a/src/CAREUI/display/Count.tsx b/src/CAREUI/display/Count.tsx index 6b28ca4f962..c04dd9ae626 100644 --- a/src/CAREUI/display/Count.tsx +++ b/src/CAREUI/display/Count.tsx @@ -2,7 +2,7 @@ import { classNames } from "../../Utils/utils"; import CareIcon, { IconName } from "../icons/CareIcon"; interface Props { - count: number; + count: number | null; text: string; loading: boolean; icon: IconName; @@ -20,7 +20,7 @@ export default function CountBlock(props: Props) {
{props.text}
- {props.loading ? ( + {props.loading || props.count == null ? (
) : (
diff --git a/src/components/Assets/AssetsList.tsx b/src/components/Assets/AssetsList.tsx index 613b87e5ea5..a249a9e78ec 100644 --- a/src/components/Assets/AssetsList.tsx +++ b/src/components/Assets/AssetsList.tsx @@ -41,7 +41,7 @@ const AssetsList = () => { const [assets, setAssets] = useState([{} as AssetData]); const [isLoading, setIsLoading] = useState(false); const [isScannerActive, setIsScannerActive] = useState(false); - const [totalCount, setTotalCount] = useState(0); + const [totalCount, setTotalCount] = useState(null); const [facility, setFacility] = useState(); const [status, setStatus] = useState(); const [asset_class, setAssetClass] = useState(); @@ -71,7 +71,7 @@ const AssetsList = () => { onResponse: ({ res, data }) => { if (res?.status === 200 && data) { setAssets(data.results); - setTotalCount(data.count); + setTotalCount(data?.count); } }, }); @@ -359,7 +359,7 @@ const AssetsList = () => {
{
{manageAssets} - + {totalCount !== null && }
diff --git a/src/components/Facility/DischargedPatientsList.tsx b/src/components/Facility/DischargedPatientsList.tsx index d9a7ac9aae7..08c09160fda 100644 --- a/src/components/Facility/DischargedPatientsList.tsx +++ b/src/components/Facility/DischargedPatientsList.tsx @@ -281,7 +281,9 @@ const DischargedPatientsList = ({
{
{