fix(dashboard): crashes when trial expired for some intervals
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user