fix: frontend fixes

Signed-off-by: Shivanshu Raj Shrivastava <shivanshu1333@gmail.com>
This commit is contained in:
Shivanshu Raj Shrivastava 2025-05-05 03:13:08 +05:30
parent 00526e3803
commit a62bf6fc60
No known key found for this signature in database
GPG Key ID: D34D26C62AC3E9AE

View File

@ -26,12 +26,17 @@ export function useFunnelMetrics({
end_time: endTime,
};
const {
data: overviewData,
isLoading,
isFetching,
isError,
} = useFunnelOverview(funnelId, payload);
// Always call both hooks to satisfy the rules of hooks
const stepsOverviewResult = useFunnelStepsOverview(funnelId, payload);
const overviewResult = useFunnelOverview(funnelId, payload);
// Select which result to use
const queryResult =
stepStart !== undefined && stepEnd !== undefined
? stepsOverviewResult
: overviewResult;
const { data: overviewData, isLoading, isFetching, isError } = queryResult;
const metricsData = useMemo(() => {
const sourceData = overviewData?.payload?.data?.[0]?.data;