From 91347d1115c3edb5b7123e11f17605d71ef153ed Mon Sep 17 00:00:00 2001 From: Morgan <33722304+ThyMinimalDev@users.noreply.github.com> Date: Wed, 29 May 2024 13:35:41 +0300 Subject: [PATCH] fix: useGetBookingForReschedule wait for calProvider init (#15236) --- packages/platform/atoms/hooks/useGetBookingForReschedule.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/platform/atoms/hooks/useGetBookingForReschedule.ts b/packages/platform/atoms/hooks/useGetBookingForReschedule.ts index b2d7f364f1a78e..ca7999ebc8b7eb 100644 --- a/packages/platform/atoms/hooks/useGetBookingForReschedule.ts +++ b/packages/platform/atoms/hooks/useGetBookingForReschedule.ts @@ -5,6 +5,7 @@ import type { getBookingForReschedule } from "@calcom/platform-libraries"; import type { ApiResponse, ApiSuccessResponse } from "@calcom/platform-types"; import http from "../lib/http"; +import { useAtomsContext } from "./useAtomsContext"; export const QUERY_KEY = "user-booking"; @@ -24,8 +25,8 @@ export const useGetBookingForReschedule = ( uid: "", } ) => { + const { isInit } = useAtomsContext(); const pathname = `/${V2_ENDPOINTS.bookings}/${props.uid}/reschedule`; - const bookingQuery = useQuery({ queryKey: [QUERY_KEY, props.uid], queryFn: () => { @@ -46,7 +47,7 @@ export const useGetBookingForReschedule = ( props.onError?.(err); }); }, - enabled: !!props?.uid, + enabled: isInit && !!props?.uid, }); return bookingQuery;