Skip to content

Commit

Permalink
remove double call on useSchedule() (calcom#11141)
Browse files Browse the repository at this point in the history
  • Loading branch information
alannnc authored Sep 4, 2023
1 parent 41ef354 commit 4258da1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/features/bookings/Booker/Booker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
);
Expand All @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 4258da1

Please sign in to comment.