fix: Dynamic duration was always overwritten with the default (30) (#12444)
Co-authored-by: Omar López <[email protected]> Co-authored-by: Morgan <[email protected]>
This commit is contained in:
4 files changed
+53
-33
No files matched your search
@@ -43,6 +43,7 @@ const BookerComponent = ({
|
||||
hideBranding = false,
|
||||
isTeamEvent,
|
||||
entity,
|
||||
durationConfig,
|
||||
duration,
|
||||
hashedLink,
|
||||
}: BookerProps) => {
|
||||
@@ -147,7 +148,7 @@ const BookerComponent = ({
|
||||
layout: defaultLayout,
|
||||
isTeamEvent,
|
||||
org: entity.orgSlug,
|
||||
durationConfig: event?.data?.metadata?.multipleDuration,
|
||||
durationConfig,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -256,14 +256,12 @@ export const useBookerStore = create<BookerStore>((set, get) => ({
|
||||
(["week_view", "column_view"].includes(layout) ? dayjs().format("YYYY-MM-DD") : null),
|
||||
});
|
||||
|
||||
if (eventId) {
|
||||
if (durationConfig?.includes(Number(getQueryParam("duration")))) {
|
||||
set({
|
||||
selectedDuration: Number(getQueryParam("duration")),
|
||||
});
|
||||
} else {
|
||||
removeQueryParam("duration");
|
||||
}
|
||||
if (durationConfig?.includes(Number(getQueryParam("duration")))) {
|
||||
set({
|
||||
selectedDuration: Number(getQueryParam("duration")),
|
||||
});
|
||||
} else {
|
||||
removeQueryParam("duration");
|
||||
}
|
||||
|
||||
// Unset selected timeslot if user is rescheduling. This could happen
|
||||
|
||||
@@ -64,6 +64,10 @@ export interface BookerProps {
|
||||
* otherwise, the default value is selected
|
||||
*/
|
||||
duration?: number | null;
|
||||
/**
|
||||
* Configures the selectable options for a multiDuration event type.
|
||||
*/
|
||||
durationConfig?: number[];
|
||||
/**
|
||||
* Refers to the private link from event types page.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user