Skip to content

Commit

Permalink
fix: Runtime error when SparkLine data contains null values (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
bourquep authored Nov 1, 2024
1 parent ecd12d1 commit a76aff2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/MetricCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function MetricCard({
const format = useFormatter();
const t = useTranslations();

const graphData = sparkLineData.map(([, value]) => Number(value.toFixed(1)));
const graphData = sparkLineData.map(([, value]) => (value != null ? Number(value.toFixed(1)) : 0));
const graphMinValue = sparkLineMinValue ?? Math.min(...graphData);
const graphMaxValue = sparkLineMaxValue ?? Math.max(...graphData);
const isGraphEmpty = graphData.filter((x) => x != 0).length == 0;
Expand Down

0 comments on commit a76aff2

Please sign in to comment.