Update queryRequests.ts

This commit is contained in:
Nate Kelley 2025-04-08 09:21:49 -06:00
parent b2b6546929
commit eba0af7c67
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 6 additions and 2 deletions

View File

@ -110,7 +110,11 @@ export const useGetMetricData = ({
id: string | undefined;
version_number?: number;
}) => {
const { isFetched: isFetchedMetric, error: errorMetric } = useGetMetric({ id });
const {
isFetched: isFetchedMetric,
error: errorMetric,
data: fetchedMetricData
} = useGetMetric({ id }, { select: (x) => x.id });
const searchParams = useSearchParams();
const queryVersionNumber = searchParams.get('metric_version_number');
@ -126,7 +130,7 @@ export const useGetMetricData = ({
...metricsQueryKeys.metricsGetData(id!, version_number),
queryFn,
enabled: () => {
return !!id && isFetchedMetric && !errorMetric;
return !!id && isFetchedMetric && !errorMetric && !!fetchedMetricData;
}
});
};