fix: Make sure cookie value stays up to date when the Next.js Router Cache is used - #790
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
amannn
marked this pull request as ready for review
January 18, 2024 18:10
juanforlizzi
pushed a commit
to juanforlizzi/next-intl
that referenced
this pull request
Jan 16, 2025
…Cache is used (amannn#790) Fixes amannn#786 If you frequently change the locale, Next.js will at some point use the Router Cache to return a previous response immediately, not making a request to the server. This has the side effect that no `set-cookie` response header is returned that will update the locale cookie. To address this, `next-intl` navigation APIs will now manually keep the cookie in sync. Note that a related issue described in amannn#786 was addressed in Next.js 14.1, so upgrading both `next` and `next-intl` is recommended.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #786
If you frequently change the locale, Next.js will at some point use the Router Cache to return a previous response immediately, not making a request to the server. This has the side effect that no
set-cookieresponse header is returned that will update the locale cookie.To address this,
next-intlnavigation APIs will now manually keep the cookie in sync.Note that a related issue described in #786 was addressed in Next.js 14.1, so upgrading both
nextandnext-intlis recommended.