Scheduling infrastructure for absolutely everyone.
remove double call on useSchedule() (#11141)
alannnc4258da1df5a7
diff --git a/packages/features/bookings/Booker/Booker.tsx b/packages/features/bookings/Booker/Booker.tsxindex d273d11fdfe..7459b4d5996 100644--- a/packages/features/bookings/Booker/Booker.tsx+++ b/packages/features/bookings/Booker/Booker.tsx@@ -49,7 +49,7 @@ const BookerComponent = ({* Prioritize dateSchedule load* Component will render but use data already fetched from here, and no duplicate requests will be made* */- useScheduleForEvent({+ const schedule = useScheduleForEvent({prefetchNextMonth: false,username,eventSlug,@@ -93,7 +93,7 @@ const BookerComponent = ({);const date = dayjs(selectedDate).format("YYYY-MM-DD");- const schedule = useScheduleForEvent({ prefetchNextMonth: true });+const nonEmptyScheduleDays = useNonEmptyScheduleDays(schedule?.data?.slots).filter((slot) => dayjs(selectedDate).diff(slot, "day") <= 0);@@ -109,7 +109,7 @@ const BookerComponent = ({? totalWeekDays: 0;- //Taking one more avaliable slot(extraDays + 1) to claculate the no of days in between, that next and prev button need to shift.+ // Taking one more available slot(extraDays + 1) to calculate the no of days in between, that next and prev button need to shift.const availableSlots = nonEmptyScheduleDays.slice(0, extraDays + 1);if (nonEmptyScheduleDays.length !== 0)columnViewExtraDays.current =diff --git a/packages/features/schedules/lib/use-schedule/useSchedule.ts b/packages/features/schedules/lib/use-schedule/useSchedule.tsindex 4e8aeac4a6c..8d6d28327cf 100644--- a/packages/features/schedules/lib/use-schedule/useSchedule.ts+++ b/packages/features/schedules/lib/use-schedule/useSchedule.ts@@ -31,7 +31,7 @@ export const useSchedule = ({const nextMonthDayjs = monthDayjs.add(monthCount ? monthCount : 1, "month");// Why the non-null assertions? All of these arguments are checked in the enabled condition,// and the query will not run if they are null. However, the check in `enabled` does- // no satisfy typscript.+ // no satisfy typescript.return trpc.viewer.public.slots.getSchedule.useQuery({isTeamEvent,