Skip to content

Scheduling infrastructure for absolutely everyone.

fix: booking limits saved as undefined (#6720)

Udit Takkara15b8fb92e49
diff --git a/apps/web/components/eventtype/EventLimitsTab.tsx b/apps/web/components/eventtype/EventLimitsTab.tsx
index 1d0f97765c2..a5e7a30d2ae 100644
--- a/apps/web/components/eventtype/EventLimitsTab.tsx
+++ b/apps/web/components/eventtype/EventLimitsTab.tsx
@@ -420,12 +420,14 @@ const BookingLimits = () => {
defaultValue={BOOKING_LIMIT_OPTIONS.find((option) => option.value === key)}
onChange={(val) => {
const current = currentBookingLimits;
+ const currentValue = watchBookingLimits[bookingLimitKey];
+
// Removes limit from previous selected value (eg when changed from per_week to per_month, we unset per_week here)
delete current[bookingLimitKey];
const newData = {
...current,
// Set limit to new selected value (in the example above this means we set the limit to per_week here).
- [val?.value as BookingLimitsKey]: watchBookingLimits[bookingLimitKey],
+ [val?.value as BookingLimitsKey]: currentValue,
};
onChange(newData);
}}
@@ -459,7 +461,7 @@ const BookingLimits = () => {
setValue("bookingLimits", {
...watchBookingLimits,
- [rest[0].value]: undefined,
+ [rest[0].value]: 1,
});
}}>
{t("add_limit")}