perf: Remove me.get call in event-types / availability (#22336)

* perf: Event types page remove me.get call

* Update ts definition listing view

* fix type check

* get rid of me call from availability page

---------

Co-authored-by: hbjORbj <[email protected]>
This commit is contained in:
Alex van AndelandhbjORbj authored and GitHub committed 2025-07-12 06:49:29 +00:00
1 parent 8cd16ee3dc
commit bd5e14b488
7 files changed
+35 -46

No files matched your search

@@ -15,19 +15,20 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
import { HttpError } from "@calcom/lib/http-error";
import type { RouterOutputs } from "@calcom/trpc/react";
import { trpc } from "@calcom/trpc/react";
import useMeQuery from "@calcom/trpc/react/hooks/useMeQuery";
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
import { ToggleGroup } from "@calcom/ui/components/form";
import { showToast } from "@calcom/ui/components/toast";
type AvailabilityListProps = {
me: RouterOutputs["viewer"]["me"]["get"];
availabilities: RouterOutputs["viewer"]["availability"]["list"];
};
export function AvailabilityList({ availabilities, me }: AvailabilityListProps) {
export function AvailabilityList({ availabilities }: AvailabilityListProps) {
const { t } = useLocale();
const [bulkUpdateModal, setBulkUpdateModal] = useState(false);
const utils = trpc.useUtils();
const router = useRouter();
const { data: user } = useMeQuery();
const deleteMutation = trpc.viewer.availability.schedule.delete.useMutation({
onMutate: async ({ scheduleId }) => {
@@ -141,9 +142,9 @@ export function AvailabilityList({ availabilities, me }: AvailabilityListProps)
{availabilities.schedules.map((schedule) => (
<ScheduleListItem
displayOptions={{
hour12: me?.timeFormat ? me.timeFormat === 12 : undefined,
timeZone: me?.timeZone,
weekStart: me?.weekStart || "Sunday",
hour12: user?.timeFormat ? user.timeFormat === 12 : undefined,
timeZone: user?.timeZone,
weekStart: user?.weekStart || "Sunday",
}}
key={schedule.id}
schedule={schedule}
@@ -928,7 +928,10 @@ const InfiniteScrollMain = ({
type Props = {
userEventGroupsData: GetUserEventGroupsResponse;
user: RouterOutputs["viewer"]["me"]["get"];
user: {
id: number;
completedOnboarding?: boolean;
} | null;
};
export const EventTypesCTA = ({ userEventGroupsData }: Omit<Props, "user">) => {