perf: /event-types/[type] — use server-fetched data to skip client-side trpc fetch (#20497)
This commit is contained in:
1 parent
c2cf55f10c
commit
97308ebf1c
4 files changed
+21
-38
No files matched your search
@@ -17,6 +17,7 @@ import { HttpError } from "@calcom/lib/http-error";
|
||||
import { telemetryEventTypes } from "@calcom/lib/telemetry";
|
||||
import { SchedulingType } from "@calcom/prisma/enums";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import type { RouterOutputs } from "@calcom/trpc/react";
|
||||
import useMeQuery from "@calcom/trpc/react/hooks/useMeQuery";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
@@ -87,10 +88,11 @@ const EventAITab = dynamic(() =>
|
||||
|
||||
export type EventTypeWebWrapperProps = {
|
||||
id: number;
|
||||
data: RouterOutputs["viewer"]["eventTypes"]["get"];
|
||||
};
|
||||
|
||||
export const EventTypeWebWrapper = ({ id }: EventTypeWebWrapperProps) => {
|
||||
const { data: eventTypeQueryData } = trpc.viewer.eventTypes.get.useQuery({ id });
|
||||
export const EventTypeWebWrapper = ({ id, data }: EventTypeWebWrapperProps) => {
|
||||
const { data: eventTypeQueryData } = trpc.viewer.eventTypes.get.useQuery({ id }, { initialData: data });
|
||||
|
||||
if (!eventTypeQueryData) return null;
|
||||
|
||||
|
||||
Reference in new issue
Block a user