Skip to content

Commit

Permalink
fix: Text content did not match (Hydration Error) (#1267)
Browse files Browse the repository at this point in the history
cookie.parse method seems to only accept base64 encode values
see remix-run/remix#5523 (comment)
  • Loading branch information
phollome authored Feb 13, 2024
1 parent 7c59ff7 commit f3fdda5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { renderToPipeableStream } from "react-dom/server";
import { I18nextProvider, initReactI18next } from "react-i18next";
import i18nConfig from "~/i18n";
import i18next from "~/i18next.server";
import { detectLanguage } from "./root.server";

declare global {
namespace NodeJS {
Expand Down Expand Up @@ -189,7 +190,7 @@ export default async function handleRequest(
loadContext: AppLoadContext
) {
const i18nInstance = createInstance();
const lng = await i18next.getLocale(request);
const lng = detectLanguage(request);
const ns = i18next.getRouteNamespaces(remixContext);

await i18nInstance
Expand Down
4 changes: 3 additions & 1 deletion app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import styles from "./styles/legacy-styles.css";
import { combineHeaders } from "./utils.server";
import { H1, H2 } from "./components/Heading/Heading";
import { initializeSentry } from "./sentry.client";
import { useChangeLanguage } from "remix-i18next";

// import newStyles from "../common/design/styles/styles.css";

Expand Down Expand Up @@ -560,7 +561,8 @@ export default function App() {
);

const { i18n } = useTranslation();
// useChangeLanguage(locale);
useChangeLanguage(locale);

const main = (
<main className="flex-auto relative pb-8 w-full">
{typeof alert !== "undefined" &&
Expand Down

0 comments on commit f3fdda5

Please sign in to comment.