From 87bcb58f2e81710147f1ba0f64ec3e954a099490 Mon Sep 17 00:00:00 2001 From: Adriano Raiano Date: Wed, 8 Mar 2023 19:57:01 +0100 Subject: [PATCH] pageProps may be undefined on strange setups #2109 --- CHANGELOG.md | 4 ++++ src/appWithTranslation.tsx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43f6de96..7e4faf4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 13.2.2 + +- pageProps may be undefined on strange setups [#2109](https://github.com/i18next/next-i18next/issues/2109)" + ## 13.2.1 - types: fix serverSideTranslations args [#2104](https://github.com/i18next/next-i18next/pull/2104)" diff --git a/src/appWithTranslation.tsx b/src/appWithTranslation.tsx index 7d71215a..9489d3af 100644 --- a/src/appWithTranslation.tsx +++ b/src/appWithTranslation.tsx @@ -24,7 +24,7 @@ export const appWithTranslation = ( const AppWithTranslation = ( props: Props & { pageProps: Props['pageProps'] & SSRConfig } ) => { - const { _nextI18Next } = props.pageProps + const { _nextI18Next } = props.pageProps || {} // pageProps may be undefined on strange setups, i.e. https://github.com/i18next/next-i18next/issues/2109 let locale: string | undefined = _nextI18Next?.initialLocale ?? props?.router?.locale const ns = _nextI18Next?.ns