fix(dashboard): crashes when trial expired for some intervals

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-03-30 22:59:49 +02:00
parent a9c664dcfb
commit ec5207947b
2 changed files with 9 additions and 1 deletions

View File

@@ -219,10 +219,14 @@ const { Tooltip, TooltipProvider } = createChartTooltip<
interval: IInterval;
}
>(({ context: { metric, interval }, data: dataArray }) => {
const data = dataArray[0]!;
const data = dataArray[0];
const formatDate = useFormatDateInterval(interval);
const number = useNumber();
if (!data) {
return null;
}
return (
<>
<div className="flex justify-between gap-8 text-muted-foreground">

View File

@@ -50,6 +50,10 @@ function getCurrentAndPrevious<
);
if (endDate) {
current.endDate = endDate;
// Only expired trial scenarios
if (new Date(current.startDate) > new Date(current.endDate)) {
current.startDate = current.endDate;
}
}
const res = await Promise.all([
fn({