fix(dashboard): time interval still wrong on funnel and retention

This commit is contained in:
Carl-Gerhard Lindesvärd
2026-01-29 12:21:46 +01:00
parent 64bcd5c155
commit 1cde7a3e35
2 changed files with 19 additions and 69 deletions

View File

@@ -2,9 +2,6 @@ import { useTRPC } from '@/integrations/trpc/react';
import type { RouterOutputs } from '@/trpc/client';
import { useQuery } from '@tanstack/react-query';
import { useOverviewOptions } from '@/components/overview/useOverviewOptions';
import type { IReportInput } from '@openpanel/validation';
import { AspectContainer } from '../aspect-container';
import { ReportChartEmpty } from '../common/empty';
import { ReportChartError } from '../common/error';
@@ -13,45 +10,18 @@ import { useReportChartContext } from '../context';
import { Chart, Summary, Tables } from './chart';
export function ReportFunnelChart() {
const {
report: {
id,
series,
range,
projectId,
options,
startDate,
endDate,
previous,
breakdowns,
interval,
},
isLazyLoading,
shareId,
} = useReportChartContext();
const { range: overviewRange, startDate: overviewStartDate, endDate: overviewEndDate, interval: overviewInterval } = useOverviewOptions();
const funnelOptions = options?.type === 'funnel' ? options : undefined;
const { isLazyLoading, report, shareId } = useReportChartContext();
const trpc = useTRPC();
const input: IReportInput = {
series,
range: overviewRange ?? range,
projectId,
interval: overviewInterval ?? interval ?? 'day',
chartType: 'funnel',
breakdowns,
previous,
metric: 'sum',
startDate: overviewStartDate ?? startDate,
endDate: overviewEndDate ?? endDate,
limit: 20,
options: funnelOptions,
};
const res = useQuery(
trpc.chart.funnel.queryOptions(input, {
enabled: !isLazyLoading && input.series.length > 0,
}),
trpc.chart.funnel.queryOptions(
{
...report,
shareId,
},
{
enabled: !isLazyLoading && report.series.length > 0,
},
),
);
if (isLazyLoading || res.isLoading) {