diff --git a/apps/web/pages/team/[slug].tsx b/apps/web/pages/team/[slug].tsx index 8d5bf7e953..f679f192eb 100644 --- a/apps/web/pages/team/[slug].tsx +++ b/apps/web/pages/team/[slug].tsx @@ -115,41 +115,46 @@ function TeamPage({ team, isUnpublished, markdownStrippedBio, isValidOrgDomain } const SubTeams = () => team.children.length ? ( ) : (
@@ -252,7 +257,6 @@ function TeamPage({ team, isUnpublished, markdownStrippedBio, isValidOrgDomain } } export const getServerSideProps = async (context: GetServerSidePropsContext) => { - const ssr = await ssrInit(context); const slug = Array.isArray(context.query?.slug) ? context.query.slug.pop() : context.query.slug; const { isValidOrgDomain, currentOrgDomain } = orgDomainConfig( context.req.headers.host ?? "", @@ -260,12 +264,15 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) => ); const flags = await getFeatureFlagMap(prisma); const team = await getTeamWithMembers({ slug, orgSlug: currentOrgDomain }); + const ssr = await ssrInit(context, { + noI18nPreload: isValidOrgDomain && !team?.parent, + }); const metadata = teamMetadataSchema.parse(team?.metadata ?? {}); - console.warn("gSSP, team/[slug] - ", { + console.info("gSSP, team/[slug] - ", { isValidOrgDomain, currentOrgDomain, ALLOWED_HOSTNAMES: process.env.ALLOWED_HOSTNAMES, - flags: JSON.stringify, + flags: JSON.stringify(flags), }); // Taking care of sub-teams and orgs if ( diff --git a/apps/web/server/lib/ssr.ts b/apps/web/server/lib/ssr.ts index 4158095666..b4ebc2a1eb 100644 --- a/apps/web/server/lib/ssr.ts +++ b/apps/web/server/lib/ssr.ts @@ -14,7 +14,7 @@ import { appRouter } from "@calcom/trpc/server/routers/_app"; * Automatically prefetches i18n based on the passed in `context`-object to prevent i18n-flickering. * Make sure to `return { props: { trpcState: ssr.dehydrate() } }` at the end. */ -export async function ssrInit(context: GetServerSidePropsContext) { +export async function ssrInit(context: GetServerSidePropsContext, options?: { noI18nPreload: boolean }) { const ctx = await createContext(context); const locale = await getLocaleFromRequest(context.req); const i18n = await serverSideTranslations(locale, ["common", "vital"]); @@ -27,7 +27,9 @@ export async function ssrInit(context: GetServerSidePropsContext) { await Promise.allSettled([ // always preload "viewer.public.i18n" - ssr.viewer.public.i18n.prefetch({ locale, CalComVersion: CALCOM_VERSION }), + !options?.noI18nPreload + ? ssr.viewer.public.i18n.prefetch({ locale, CalComVersion: CALCOM_VERSION }) + : Promise.resolve({}), // So feature flags are available on first render ssr.viewer.features.map.prefetch(), // Provides a better UX to the users who have already upgraded.