From b9c350cc4512731a3335264c8c80ed231501378e Mon Sep 17 00:00:00 2001 From: Sachin Yadav <88329785+designed2code@users.noreply.github.com> Date: Mon, 3 Nov 2025 21:50:15 +0530 Subject: [PATCH] fix: Recurring events set to "yearly" don't recur (#24361) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * #fix: Recurring events set to “yearly” don’t recur * fix: handle yearly recurring events with explicit null check * fix: use explicit null check for recurring event frequency --- apps/web/components/booking/BookingListItem.tsx | 2 +- packages/lib/recurringStrings.ts | 2 +- .../platform/atoms/hooks/bookings/useHandleBookEvent.ts | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/web/components/booking/BookingListItem.tsx b/apps/web/components/booking/BookingListItem.tsx index e4de4c315e..b8eb7954ef 100644 --- a/apps/web/components/booking/BookingListItem.tsx +++ b/apps/web/components/booking/BookingListItem.tsx @@ -903,7 +903,7 @@ const RecurringBookingsTooltip = ({ return ( (booking.recurringInfo && - booking.eventType?.recurringEvent?.freq && + booking.eventType?.recurringEvent?.freq != null && (booking.listingStatus === "recurring" || booking.listingStatus === "unconfirmed" || booking.listingStatus === "cancelled") && ( diff --git a/packages/lib/recurringStrings.ts b/packages/lib/recurringStrings.ts index 6a27273995..61ee2b4abc 100644 --- a/packages/lib/recurringStrings.ts +++ b/packages/lib/recurringStrings.ts @@ -34,7 +34,7 @@ export const getEveryFreqFor = ({ recurringCount?: number; recurringFreq?: string; }): string => { - if (recurringEvent.freq) { + if (recurringEvent.freq != null) { return `${recurringFreq || getRecurringFreq({ t, recurringEvent })} ${ recurringCount || recurringEvent.count } ${t("occurrence", { diff --git a/packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts b/packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts index 8260e05cb8..b84021d7d3 100644 --- a/packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts +++ b/packages/platform/atoms/hooks/bookings/useHandleBookEvent.ts @@ -14,7 +14,7 @@ import { showToast } from "@calcom/ui/components/toast"; import { getUtmTrackingParameters } from "../../lib/getUtmTrackingParameters"; import type { UseCreateBookingInput } from "./useCreateBooking"; -type Callbacks = { onSuccess?: () => void; onError?: (err: any) => void }; +type Callbacks = { onSuccess?: () => void; onError?: (err: unknown) => void }; type UseHandleBookingProps = { bookingForm: UseBookingFormReturnType["bookingForm"]; event?: { @@ -64,8 +64,8 @@ export const useHandleBookEvent = ({ const crmAppSlug = useBookerStoreContext((state) => state.crmAppSlug); const crmRecordId = useBookerStoreContext((state) => state.crmRecordId); const verificationCode = useBookerStoreContext((state) => state.verificationCode); - const handleError = (err: any) => { - const errorMessage = err?.message ? t(err.message) : t("can_you_try_again"); + const handleError = (err: unknown) => { + const errorMessage = err instanceof Error ? t(err.message) : t("can_you_try_again"); showToast(errorMessage, "error"); }; const searchParams = useSearchParams(); @@ -121,7 +121,7 @@ export const useHandleBookEvent = ({ if (isInstantMeeting) { handleInstantBooking(mapBookingToMutationInput(bookingInput), callbacks); - } else if (event.data?.recurringEvent?.freq && recurringEventCount && !rescheduleUid) { + } else if (event.data?.recurringEvent?.freq != null && recurringEventCount && !rescheduleUid) { handleRecBooking( mapRecurringBookingToMutationInput(bookingInput, recurringEventCount, tracking), callbacks