Only enable when defaultScheduleId is truthy (#9968)

pull/9948/head^2
Alex van Andel 2023-07-07 02:06:37 +02:00 committed by GitHub
parent afd41475c9
commit cbe1907118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 9 deletions

View File

@ -22,15 +22,13 @@ const SetupAvailability = (props: ISetupAvailabilityProps) => {
const { nextStep } = props;
const router = useRouter();
let queryAvailability;
if (defaultScheduleId) {
queryAvailability = trpc.viewer.availability.schedule.get.useQuery(
{ scheduleId: defaultScheduleId },
{
enabled: router.isReady,
}
);
}
const queryAvailability = trpc.viewer.availability.schedule.get.useQuery(
{ scheduleId: defaultScheduleId! },
{
enabled: router.isReady && !!defaultScheduleId,
}
);
const availabilityForm = useForm({
defaultValues: {