fix(dashboard): crashes when trial expired for some intervals
This commit is contained in:
@@ -219,10 +219,14 @@ const { Tooltip, TooltipProvider } = createChartTooltip<
|
|||||||
interval: IInterval;
|
interval: IInterval;
|
||||||
}
|
}
|
||||||
>(({ context: { metric, interval }, data: dataArray }) => {
|
>(({ context: { metric, interval }, data: dataArray }) => {
|
||||||
const data = dataArray[0]!;
|
const data = dataArray[0];
|
||||||
const formatDate = useFormatDateInterval(interval);
|
const formatDate = useFormatDateInterval(interval);
|
||||||
const number = useNumber();
|
const number = useNumber();
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="flex justify-between gap-8 text-muted-foreground">
|
<div className="flex justify-between gap-8 text-muted-foreground">
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ function getCurrentAndPrevious<
|
|||||||
);
|
);
|
||||||
if (endDate) {
|
if (endDate) {
|
||||||
current.endDate = 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([
|
const res = await Promise.all([
|
||||||
fn({
|
fn({
|
||||||
|
|||||||
Reference in New Issue
Block a user