Scheduling infrastructure for absolutely everyone.
fix: EventAvailabilityTab atom breaking (#22059)
Somay Chauhan50608247955b
diff --git a/packages/features/eventtypes/components/tabs/availability/EventAvailabilityTab.tsx b/packages/features/eventtypes/components/tabs/availability/EventAvailabilityTab.tsxindex 7ffb5388c39..b6ed32f7994 100644--- a/packages/features/eventtypes/components/tabs/availability/EventAvailabilityTab.tsx+++ b/packages/features/eventtypes/components/tabs/availability/EventAvailabilityTab.tsx@@ -24,7 +24,6 @@ import { weekdayNames } from "@calcom/lib/weekday";import { weekStartNum } from "@calcom/lib/weekstart";import { SchedulingType } from "@calcom/prisma/enums";import type { RouterOutputs } from "@calcom/trpc/react";-import { trpc } from "@calcom/trpc/react";import classNames from "@calcom/ui/classNames";import { Avatar } from "@calcom/ui/components/avatar";import { Badge } from "@calcom/ui/components/badge";@@ -121,6 +120,7 @@ type EventTypeScheduleProps = {isSchedulePending?: boolean;isRestrictionSchedulePending?: boolean;restrictionScheduleRedirectUrl?: string;+ isRestrictionScheduleEnabled?: boolean;} & Omit<EventTypeScheduleDetailsProps, "customClassNames"> &Omit<EventTypeTeamScheduleProps, "customClassNames">;@@ -810,6 +810,7 @@ const useRestrictionScheduleState = (initialRestrictionScheduleId: number | nullconst UseTeamEventScheduleSettingsToggle = ({eventType,customClassNames,+ isRestrictionScheduleEnabled,...rest}: UseTeamEventScheduleSettingsToggle) => {const { t } = useLocale();@@ -819,18 +820,6 @@ const UseTeamEventScheduleSettingsToggle = ({eventType.restrictionScheduleId);- // Check if team has restriction schedule feature enabled- const { data: isRestrictionScheduleEnabled = false } = trpc.viewer.features.checkTeamFeature.useQuery(- {- teamId: eventType.team?.id || 0,- feature: "restriction-schedule",- },- {- enabled: !!eventType.team?.id,- staleTime: 5 * 60 * 1000, // Cache for 5 minutes- }- );-return (<div className="space-y-4"><div className="border-subtle space-y-6 rounded-lg border p-6">diff --git a/packages/platform/atoms/event-types/wrappers/EventAvailabilityTabWebWrapper.tsx b/packages/platform/atoms/event-types/wrappers/EventAvailabilityTabWebWrapper.tsxindex 62c168420dc..2880680abc3 100644--- a/packages/platform/atoms/event-types/wrappers/EventAvailabilityTabWebWrapper.tsx+++ b/packages/platform/atoms/event-types/wrappers/EventAvailabilityTabWebWrapper.tsx@@ -30,6 +30,18 @@ const EventAvailabilityTabWebWrapper = (props: EventAvailabilityTabWebWrapperProformMethods,});+ // Check if team has restriction schedule feature enabled+ const { data: isRestrictionScheduleEnabled = false } = trpc.viewer.features.checkTeamFeature.useQuery(+ {+ teamId: props.eventType.team?.id || 0,+ feature: "restriction-schedule",+ },+ {+ enabled: !!props.eventType.team?.id,+ staleTime: 5 * 60 * 1000, // Cache for 5 minutes+ }+ );+const { isPending: isSchedulePending, data: scheduleQueryData } =trpc.viewer.availability.schedule.get.useQuery({@@ -66,6 +78,7 @@ const EventAvailabilityTabWebWrapper = (props: EventAvailabilityTabWebWrapperProeditAvailabilityRedirectUrl={`/availability/${scheduleQueryData?.id}`}restrictionScheduleRedirectUrl={`/availability/${restrictionScheduleQueryData?.id}`}hostSchedulesQuery={hostSchedulesQuery}+ isRestrictionScheduleEnabled={isRestrictionScheduleEnabled}/>);};