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 { nextStep } = props;
const router = useRouter(); const router = useRouter();
let queryAvailability;
if (defaultScheduleId) { const queryAvailability = trpc.viewer.availability.schedule.get.useQuery(
queryAvailability = trpc.viewer.availability.schedule.get.useQuery( { scheduleId: defaultScheduleId! },
{ scheduleId: defaultScheduleId }, {
{ enabled: router.isReady && !!defaultScheduleId,
enabled: router.isReady, }
} );
);
}
const availabilityForm = useForm({ const availabilityForm = useForm({
defaultValues: { defaultValues: {