Skip to content

Commit 0acff80

Browse files
fix(next): persist language cookie across browser sessions (#15081)
### What? Persist the language selection cookie by setting a max age so it survives browser restarts. ### Why? The language cookie was session-only, so closing the browser reset the language preference. ### How? Add `maxAge` to the language cookie set in `switchLanguageServerAction` within `packages/next/src/layouts/Root/index.tsx`.
1 parent a00267d commit 0acff80

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

packages/next/src/layouts/Root/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ const RootLayoutContent = async ({
102102
const cookies = await nextCookies()
103103
cookies.set({
104104
name: `${config.cookiePrefix || 'payload'}-lng`,
105+
maxAge: 60 * 60 * 24 * 365,
105106
path: '/',
106107
value: lang,
107108
})

0 commit comments

Comments
 (0)