From d72a1ee3285f91477ffed3cf3d562605dd58e480 Mon Sep 17 00:00:00 2001 From: Greg Pabian <35925521+grzpab@users.noreply.github.com> Date: Wed, 11 Oct 2023 17:15:11 +0200 Subject: [PATCH] hotfix: use session locale when dealing with SSG-ed pages (#11831) --- apps/web/lib/app-providers.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/web/lib/app-providers.tsx b/apps/web/lib/app-providers.tsx index bc2d3aed78..50bde13463 100644 --- a/apps/web/lib/app-providers.tsx +++ b/apps/web/lib/app-providers.tsx @@ -71,7 +71,11 @@ const CustomI18nextProvider = (props: AppPropsWithoutNonce) => { /** * i18n should never be clubbed with other queries, so that it's caching can be managed independently. **/ - const clientViewerI18n = useViewerI18n(props.pageProps.newLocale); + + const session = useSession(); + const locale = session?.data?.user.locale ?? props.pageProps.newLocale; + + const clientViewerI18n = useViewerI18n(locale); const i18n = clientViewerI18n.data?.i18n; const passedProps = { @@ -247,8 +251,8 @@ const AppProviders = (props: AppPropsWithChildren) => { const RemainingProviders = ( - - + + {/* color-scheme makes background:transparent not work which is required by embed. We need to ensure next-theme adds color-scheme to `body` instead of `html`(https://github.com/pacocoursey/next-themes/blob/main/src/index.tsx#L74). Once that's done we can enable color-scheme support */} { - - + + );