Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: Remove two trpc.viewer.public.event calls & use EventTypeRepository in RSCs #20536

Draft
wants to merge 37 commits into
base: main
Choose a base branch
from

Conversation

hbjORbj
Copy link
Contributor

@hbjORbj hbjORbj commented Apr 4, 2025

What does this PR do?

  1. Remove two trpc.viewer.public.event calls by refactoring to use already server-fetched data
  2. Instead of using trpc router, use EventTypeRepository directly to fetch event type data in RSCs

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A - I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • covered by e2e tests

@hbjORbj hbjORbj requested review from a team as code owners April 4, 2025 01:13
@graphite-app graphite-app bot requested a review from a team April 4, 2025 01:13
Copy link

vercel bot commented Apr 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cal-com-ui-playground ❌ Failed (Inspect) Apr 6, 2025 2:40am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Apr 6, 2025 2:40am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Apr 6, 2025 2:40am

@keithwillcode keithwillcode added core area: core, team members only foundation labels Apr 4, 2025
@hbjORbj hbjORbj changed the base branch from main to perf/user-type-booking-page April 4, 2025 01:13
@dosubot dosubot bot added booking-page area: booking page, public booking page, booker event-types area: event types, event-types labels Apr 4, 2025
Base automatically changed from perf/user-type-booking-page to main April 4, 2025 01:13
@hbjORbj hbjORbj changed the title perf: move public event to eventtype router perf: move public.event query to event type router Apr 4, 2025
Copy link

graphite-app bot commented Apr 4, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (04/04/25)

1 reviewer was added to this PR based on Keith Williams's automation.

@hbjORbj hbjORbj marked this pull request as ready for review April 4, 2025 02:25
@dosubot dosubot bot added the performance area: performance, page load, slow, slow endpoints, loading screen, unresponsive label Apr 4, 2025
@hbjORbj hbjORbj changed the title perf: move public.event query to event type router perf: use move public.event query to event type router & use EventTypeRepository in RSCs Apr 5, 2025
@hbjORbj hbjORbj changed the title perf: use move public.event query to event type router & use EventTypeRepository in RSCs perf: move trpc.public.event query to event type router & use EventTypeRepository in RSCs Apr 5, 2025
event: {
data?: Pick<BookerEvent, "length" | "bookingFields" | "price" | "currency" | "metadata"> | null;
};
eventData: Pick<RouterOutputs["viewer"]["eventTypes"]["get"], "price" | "currency" | "length" | "metadata">;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bookingFields isn't needed

@@ -367,7 +366,7 @@ const EmailEmbed = ({
locale={i18n.language}
browsingDate={month ? dayjs(month) : undefined}
selected={dayjs(selectedDate)}
weekStart={weekdayToWeekIndex(event?.data?.subsetOfUsers?.[0]?.weekStart)}
weekStart={weekdayToWeekIndex(eventTypeData?.users?.[0]?.weekStart)}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double check on this

@hbjORbj hbjORbj changed the title perf: move trpc.public.event query to event type router & use EventTypeRepository in RSCs perf: remove getPublicEvent fetch by refactoring & use EventTypeRepository in RSCs Apr 5, 2025
import { useBookerTime } from "../hooks/useBookerTime";

const BookEventFormWrapper = ({ children, onCancel }: { onCancel: () => void; children: ReactNode }) => {
const { data } = useEvent();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing trpc.viewer.public.event call

@@ -271,7 +271,6 @@ const EmailEmbed = ({
],
shallow
);
const event = useEvent();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing trpc.viewer.public.event call

@hbjORbj hbjORbj changed the title perf: remove getPublicEvent fetch by refactoring & use EventTypeRepository in RSCs perf: Remove two trpc.viewer.public.event calls & use EventTypeRepository in RSCs Apr 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
booking-page area: booking page, public booking page, booker core area: core, team members only event-types area: event types, event-types foundation performance area: performance, page load, slow, slow endpoints, loading screen, unresponsive ready-for-e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants