- App Router: the proxy only writes the language cookie when the language changed — every response used to re-set the cookie: internal-mode rewrites on every request, the default and
hideDefaultLocaleredirects, and the referer branch on every navigation from a locale-prefixed page. Next merges a cookie set in middleware into the request's mutable cookies and treats any modified cookie as a revalidation, so every Server Action (its POST carries the page as referer) made the client router drop its cache and refetch the page, resetting remounted forms along the way. The write is now skipped when the incoming cookie already holds the resolved language. Trade-off: the cookie'smaxAgeis refreshed only on change. #2346 - App Router:
persistCookieandcookieOptions—persistCookie: falsemakes the proxy read the language cookie without ever writing it, for apps where another system owns it.cookieOptions(domain,secure,sameSite,path,maxAge) is applied on top of the defaults when the proxy does write, anduseChangeLanguage(cookieName?, cookieOptions?)accepts the same options so both writers agree on the cookie's scope. #2346