perf: duplicate getSchedule request (#17191)
* fix: duplicate getSchedule request * fix: add event type id
This commit is contained in:
1 parent
f70e8c5189
commit
c7f4f52efa
9 files changed
+15
-11
No files matched your search
@@ -32,6 +32,7 @@ export interface BookerProps {
|
||||
teamSlug?: string | null;
|
||||
name?: string | null;
|
||||
logoUrl?: string | null;
|
||||
eventTypeId?: number | null;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,6 +72,7 @@ export const useScheduleForEvent = ({
|
||||
orgSlug,
|
||||
teamMemberEmail,
|
||||
fromRedirectOfNonOrgLink,
|
||||
isTeamEvent,
|
||||
}: {
|
||||
prefetchNextMonth?: boolean;
|
||||
username?: string | null;
|
||||
@@ -85,9 +86,9 @@ export const useScheduleForEvent = ({
|
||||
orgSlug?: string;
|
||||
teamMemberEmail?: string | null;
|
||||
fromRedirectOfNonOrgLink?: boolean;
|
||||
isTeamEvent?: boolean;
|
||||
} = {}) => {
|
||||
const { timezone } = useTimePreferences();
|
||||
const event = useEvent({ fromRedirectOfNonOrgLink });
|
||||
const [usernameFromStore, eventSlugFromStore, monthFromStore, durationFromStore] = useBookerStore(
|
||||
(state) => [state.username, state.eventSlug, state.month, state.selectedDuration],
|
||||
shallow
|
||||
@@ -98,12 +99,10 @@ export const useScheduleForEvent = ({
|
||||
|
||||
const pathname = usePathname();
|
||||
|
||||
const isTeam = !!event.data?.team?.parentId;
|
||||
|
||||
const schedule = useSchedule({
|
||||
username: usernameFromStore ?? username,
|
||||
eventSlug: eventSlugFromStore ?? eventSlug,
|
||||
eventId: event.data?.id ?? eventId,
|
||||
eventId,
|
||||
timezone,
|
||||
selectedDate,
|
||||
prefetchNextMonth,
|
||||
@@ -112,7 +111,7 @@ export const useScheduleForEvent = ({
|
||||
rescheduleUid,
|
||||
month: monthFromStore ?? month,
|
||||
duration: durationFromStore ?? duration,
|
||||
isTeamEvent: pathname?.indexOf("/team/") !== -1 || isTeam,
|
||||
isTeamEvent,
|
||||
orgSlug,
|
||||
teamMemberEmail,
|
||||
});
|
||||
|
||||
@@ -172,7 +172,7 @@ const EmailEmbed = ({
|
||||
shallow
|
||||
);
|
||||
const event = useEvent();
|
||||
const schedule = useScheduleForEvent({ orgSlug });
|
||||
const schedule = useScheduleForEvent({ orgSlug, eventId: eventType?.id, isTeamEvent });
|
||||
const nonEmptyScheduleDays = useNonEmptyScheduleDays(schedule?.data?.slots);
|
||||
|
||||
const onTimeSelect = (time: string) => {
|
||||
|
||||
Reference in new issue
Block a user