remove double call on useSchedule() (#11141)

pull/11093/head^2
alannnc 2023-09-04 16:10:19 -07:00 committed by GitHub
parent 41ef354c7b
commit 4258da1df5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -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 =

View File

@ -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,