From d6395dffffb7472dc70e5b527e379bde5432424d Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Wed, 20 Jul 2022 15:08:33 +1000 Subject: [PATCH] =?UTF-8?q?Percentage:=20don=E2=80=99t=20display=20if=20va?= =?UTF-8?q?lue=20null=20or=20undefined?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fields/Percentage/BasicCell.tsx | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/components/fields/Percentage/BasicCell.tsx b/src/components/fields/Percentage/BasicCell.tsx index c2dbef58..5f6228aa 100644 --- a/src/components/fields/Percentage/BasicCell.tsx +++ b/src/components/fields/Percentage/BasicCell.tsx @@ -5,17 +5,19 @@ import { useTheme } from "@mui/material"; export default function Percentage({ value }: IBasicCellProps) { const theme = useTheme(); + if (value === null || value === undefined) return null; + const percentage = typeof value === "number" ? value : 0; return ( -
- {Math.round(percentage * 100)}% -
+
+ {Math.round(percentage * 100)}% +
); }