-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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: run ssrInit()
at root layout
#19460
Conversation
ssrInit()
at root layout
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (02/21/25)1 reviewer was added to this PR based on Keith Williams's automation. |
E2E results are ready! |
export default async function PageWrapperLayout({ children }: { children: React.ReactNode }) { | ||
const h = headers(); | ||
const nonce = h.get("x-nonce") ?? undefined; | ||
|
||
const context = buildLegacyCtx(headers(), cookies(), {}, {}); | ||
const ssr = await ssrInit(context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
export default async function BookingPageWrapperLayout({ children }: { children: React.ReactNode }) { | ||
const h = headers(); | ||
const nonce = h.get("x-nonce") ?? undefined; | ||
const context = buildLegacyCtx(h, cookies(), {}, {}); | ||
const ssr = await ssrInit(context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
@@ -56,6 +59,7 @@ export default async function RootLayout({ children }: { children: React.ReactNo | |||
? getFallbackProps() | |||
: await getInitialProps(fullUrl); | |||
|
|||
const ssr = await ssrInit(buildLegacyCtx(h, cookies(), {}, {})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added here (higher level in hierarchy)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes more sense! I think it's working well on my local machine.
What does this PR do?
ssrInit()
is a function that prefetches i18n translations and some important data (feature flags, team plan, session, user data): https://github.com/calcom/cal.com/blob/main/apps/web/server/lib/ssr.ts#L57ssrInit()
is currently ran at(use-page-wrapper)/layout.tsx
and(booking-page-wrapper)/layout.tsx
app/layout.tsx
)Mandatory Tasks (DO NOT REMOVE)
How should this be tested?