From cbe1907118109b73c54062ab31d77321adf3a1db Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Fri, 7 Jul 2023 02:06:37 +0200 Subject: [PATCH] Only enable when defaultScheduleId is truthy (#9968) --- .../steps-views/SetupAvailability.tsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/apps/web/components/getting-started/steps-views/SetupAvailability.tsx b/apps/web/components/getting-started/steps-views/SetupAvailability.tsx index bd021820e5..6ad80e030f 100644 --- a/apps/web/components/getting-started/steps-views/SetupAvailability.tsx +++ b/apps/web/components/getting-started/steps-views/SetupAvailability.tsx @@ -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: {