From 860e13c0a3536748381eeeebbd938fba6ea0b6ad Mon Sep 17 00:00:00 2001 From: ichiwa Date: Mon, 23 Oct 2023 13:19:44 +0900 Subject: [PATCH] revert: Revert the deletion of empty lines --- .../src/app/client/create-i18n-provider-client.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/next-international/src/app/client/create-i18n-provider-client.tsx b/packages/next-international/src/app/client/create-i18n-provider-client.tsx index 0a46753..7a57616 100644 --- a/packages/next-international/src/app/client/create-i18n-provider-client.tsx +++ b/packages/next-international/src/app/client/create-i18n-provider-client.tsx @@ -3,13 +3,17 @@ import type { Context, ReactNode } from 'react'; import React, { Suspense, use, useMemo } from 'react'; import { flattenLocale } from '../../common/flatten-locale'; import type { LocaleContext } from '../../types'; + type I18nProviderProps = Omit; + type I18nProviderWrapperProps = { locale: string; fallback?: ReactNode; children: ReactNode; }; + export const localesCache = new Map>(); + export function createI18nProviderClient( I18nClientContext: Context | null>, locales: ImportedLocales, @@ -17,6 +21,7 @@ export function createI18nProviderClient( ) { function I18nProvider({ locale, children }: I18nProviderProps) { let clientLocale: any = localesCache.get(locale); + if (!clientLocale) { const newLocale = locales[locale as keyof typeof locales]; if (!newLocale) { @@ -35,8 +40,10 @@ export function createI18nProviderClient( }), [clientLocale, locale], ); + return {children}; } + return function I18nProviderWrapper({ locale, fallback, children }: I18nProviderWrapperProps) { return ( @@ -44,4 +51,4 @@ export function createI18nProviderClient( ); }; -} +} \ No newline at end of file