perf: prevent refetching i18n on route change (#8535)

* fix: prevent refetching i18n on route change

* remove additional properties

---------

Co-authored-by: Keith Williams <keithwillcode@gmail.com>
This commit is contained in:
Nafees Nazik
2023-04-27 10:55:26 +00:00
committed by GitHub
co-authored by Keith Williams
parent d2f8a5c076
commit 8a6c420268
+3 -3
View File
@@ -19,6 +19,8 @@ import { MetaProvider } from "@calcom/ui";
import usePublicPage from "@lib/hooks/usePublicPage";
import type { WithNonceProps } from "@lib/withNonce";
import { useViewerI18n } from "@components/I18nLanguageHandler";
const I18nextAdapter = appWithTranslation<NextJsAppProps<SSRConfig> & { children: React.ReactNode }>(
({ children }) => <>{children}</>
);
@@ -46,9 +48,7 @@ const CustomI18nextProvider = (props: AppPropsWithChildren) => {
* i18n should never be clubbed with other queries, so that it's caching can be managed independently.
* We intend to not cache i18n query
**/
const { i18n, locale } = trpc.viewer.public.i18n.useQuery(undefined, {
trpc: { context: { skipBatch: true } },
}).data ?? {
const { i18n, locale } = useViewerI18n().data ?? {
locale: "en",
};