diff --git a/app/components/Header.tsx b/app/components/Header.tsx index 54604d1..95ac994 100644 --- a/app/components/Header.tsx +++ b/app/components/Header.tsx @@ -48,8 +48,11 @@ const Header = () => { try { const pathWithoutLocale = pathname.replace(new RegExp(`^/${locale}`), "") || ""; const hash = typeof window !== "undefined" ? window.location.hash : ""; + // Rely on middleware to persist NEXT_LOCALE cookie. + // Avoid setting cookies from the client here; in some environments this can throw + // and prevent navigation. router.push(`/${nextLocale}${pathWithoutLocale}${hash}`); - document.cookie = `NEXT_LOCALE=${nextLocale}; path=/`; + router.refresh(); } catch { // ignore }