From 878a7cbfc5f4acbbc8e0c347a87ecb4b1f0efb90 Mon Sep 17 00:00:00 2001 From: Pradumn Kumar <47187878+Pradumn27@users.noreply.github.com> Date: Wed, 5 Jul 2023 03:21:41 +0530 Subject: [PATCH] fix: app crash issue on setting a greater recurring count than the maximum (#9899) --- apps/web/components/booking/pages/AvailabilityPage.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/web/components/booking/pages/AvailabilityPage.tsx b/apps/web/components/booking/pages/AvailabilityPage.tsx index 24c6d438c8..c01d8e44b0 100644 --- a/apps/web/components/booking/pages/AvailabilityPage.tsx +++ b/apps/web/components/booking/pages/AvailabilityPage.tsx @@ -204,7 +204,13 @@ const AvailabilityPage = ({ profile, eventType, ...restProps }: Props) => { isFullWidth={false} className="me-2 inline w-16" onChange={(event) => { - setRecurringEventCount(parseInt(event?.target.value)); + const count = + eventType?.recurringEvent?.count && + parseInt(event?.target.value) > eventType?.recurringEvent?.count + ? eventType.recurringEvent.count + : parseInt(event?.target.value); + + setRecurringEventCount(count); }} />