From 261c97f97bd1618735f1211fb304fdf6774bd6df Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Thu, 23 May 2024 14:19:02 +0200 Subject: [PATCH] Fix i18n double init on web --- front/apps/web/src/i18n.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/front/apps/web/src/i18n.tsx b/front/apps/web/src/i18n.tsx index 588e5676..f061c911 100644 --- a/front/apps/web/src/i18n.tsx +++ b/front/apps/web/src/i18n.tsx @@ -20,7 +20,7 @@ import i18next, { type InitOptions } from "i18next"; import type { AppContext, AppInitialProps, AppProps } from "next/app"; -import { type ComponentType, useMemo } from "react"; +import { type ComponentType, useState } from "react"; import { I18nextProvider } from "react-i18next"; import resources from "../../../translations"; @@ -40,14 +40,14 @@ export const withTranslations = ( }; const AppWithTranslations = (props: AppProps) => { - const li18n = useMemo(() => { + const [li18n] = useState(() => { if (typeof window === "undefined") return i18n; i18next.init({ ...commonOptions, lng: props.pageProps.__lang, }); return i18next; - }, [props.pageProps.__lang]); + }); return (