Skip to content

Commit

Permalink
fix: useGetBookingForReschedule wait for calProvider init (#15236)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThyMinimalDev authored May 29, 2024
1 parent 2c8c836 commit 91347d1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/platform/atoms/hooks/useGetBookingForReschedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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: () => {
Expand All @@ -46,7 +47,7 @@ export const useGetBookingForReschedule = (
props.onError?.(err);
});
},
enabled: !!props?.uid,
enabled: isInit && !!props?.uid,
});

return bookingQuery;
Expand Down

0 comments on commit 91347d1

Please sign in to comment.