fix: NaN deltas

This commit is contained in:
TrèsAbhi committed 2024-04-08 09:13:14 -05:00
1 parent 0a38c164a4
commit 02129feb25
1 file changed
+9 -6
+9 -6
View File
@@ -214,6 +214,11 @@ export default function Page() {
const normalizedDeltaPercentage = Math.round( const normalizedDeltaPercentage = Math.round(
Math.min(100, Math.abs(deltaPercentage) * 2 * 100 + 25), Math.min(100, Math.abs(deltaPercentage) * 2 * 100 + 25),
); );
const resolvedDisplayValue = display
? display(stats[index])
: decimals === undefined
? value
: value?.toFixed(decimals);
return ( return (
<Table.Cell <Table.Cell
@@ -244,14 +249,12 @@ export default function Page() {
}} }}
> >
<Text style={{ textAlign: 'center' }} wrap="nowrap"> <Text style={{ textAlign: 'center' }} wrap="nowrap">
{display {resolvedDisplayValue}
? display(stats[index])
: decimals === undefined
? value
: value?.toFixed(decimals)}
</Text> </Text>
{delta !== 0 && ( {delta !== 0 &&
resolvedDisplayValue !== undefined &&
values[0] !== undefined && (
<> <>
{deltaMode === 'absolute' && ( {deltaMode === 'absolute' && (
<Text color="gray"> <Text color="gray">