remove double call on useSchedule() (#11141)
parent
41ef354c7b
commit
4258da1df5
|
@ -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 =
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue