fix(dashboard): actually lazy load reports
This commit is contained in:
@@ -13,6 +13,7 @@ export function ReportAreaChart() {
|
|||||||
const res = api.chart.chart.useQuery(report, {
|
const res = api.chart.chart.useQuery(report, {
|
||||||
keepPreviousData: true,
|
keepPreviousData: true,
|
||||||
staleTime: 1000 * 60 * 1,
|
staleTime: 1000 * 60 * 1,
|
||||||
|
enabled: !isLazyLoading,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export function ReportBarChart() {
|
|||||||
const res = api.chart.chart.useQuery(report, {
|
const res = api.chart.chart.useQuery(report, {
|
||||||
keepPreviousData: true,
|
keepPreviousData: true,
|
||||||
staleTime: 1000 * 60 * 1,
|
staleTime: 1000 * 60 * 1,
|
||||||
|
enabled: !isLazyLoading,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export function ReportFunnelChart() {
|
|||||||
};
|
};
|
||||||
const res = api.chart.funnel.useQuery(input, {
|
const res = api.chart.funnel.useQuery(input, {
|
||||||
keepPreviousData: true,
|
keepPreviousData: true,
|
||||||
|
enabled: !isLazyLoading,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isLazyLoading || res.isLoading) {
|
if (isLazyLoading || res.isLoading) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export function ReportHistogramChart() {
|
|||||||
const res = api.chart.chart.useQuery(report, {
|
const res = api.chart.chart.useQuery(report, {
|
||||||
keepPreviousData: true,
|
keepPreviousData: true,
|
||||||
staleTime: 1000 * 60 * 1,
|
staleTime: 1000 * 60 * 1,
|
||||||
|
enabled: !isLazyLoading,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export function ReportLineChart() {
|
|||||||
const res = api.chart.chart.useQuery(report, {
|
const res = api.chart.chart.useQuery(report, {
|
||||||
keepPreviousData: true,
|
keepPreviousData: true,
|
||||||
staleTime: 1000 * 60 * 1,
|
staleTime: 1000 * 60 * 1,
|
||||||
|
enabled: !isLazyLoading,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export function ReportMapChart() {
|
|||||||
const res = api.chart.chart.useQuery(report, {
|
const res = api.chart.chart.useQuery(report, {
|
||||||
keepPreviousData: true,
|
keepPreviousData: true,
|
||||||
staleTime: 1000 * 60 * 1,
|
staleTime: 1000 * 60 * 1,
|
||||||
|
enabled: !isLazyLoading,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export function ReportMetricChart() {
|
|||||||
const res = api.chart.chart.useQuery(report, {
|
const res = api.chart.chart.useQuery(report, {
|
||||||
keepPreviousData: true,
|
keepPreviousData: true,
|
||||||
staleTime: 1000 * 60 * 1,
|
staleTime: 1000 * 60 * 1,
|
||||||
|
enabled: !isLazyLoading,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export function ReportPieChart() {
|
|||||||
const res = api.chart.chart.useQuery(report, {
|
const res = api.chart.chart.useQuery(report, {
|
||||||
keepPreviousData: true,
|
keepPreviousData: true,
|
||||||
staleTime: 1000 * 60 * 1,
|
staleTime: 1000 * 60 * 1,
|
||||||
|
enabled: !isLazyLoading,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ export function ReportRetentionChart() {
|
|||||||
} = useReportChartContext();
|
} = useReportChartContext();
|
||||||
const firstEvent = (events[0]?.filters[0]?.value ?? []).map(String);
|
const firstEvent = (events[0]?.filters[0]?.value ?? []).map(String);
|
||||||
const secondEvent = (events[1]?.filters[0]?.value ?? []).map(String);
|
const secondEvent = (events[1]?.filters[0]?.value ?? []).map(String);
|
||||||
const isEnabled = firstEvent.length > 0 && secondEvent.length > 0;
|
const isEnabled =
|
||||||
|
firstEvent.length > 0 && secondEvent.length > 0 && !isLazyLoading;
|
||||||
const res = api.chart.cohort.useQuery(
|
const res = api.chart.cohort.useQuery(
|
||||||
{
|
{
|
||||||
firstEvent,
|
firstEvent,
|
||||||
@@ -38,6 +39,8 @@ export function ReportRetentionChart() {
|
|||||||
interval,
|
interval,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
keepPreviousData: true,
|
||||||
|
staleTime: 1000 * 60 * 1,
|
||||||
enabled: isEnabled,
|
enabled: isEnabled,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user