fix: use React.cache for per-request namespace isolation in RSC template#96
fix: use React.cache for per-request namespace isolation in RSC template#96
Conversation
Replace globalThis namespace merge with i18nRequestStore from next-translate. During static builds, each locale render now gets its own namespace accumulator via React.cache, preventing cross-locale pollution where namespaces from one locale leaked into another.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8573461bef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| import ${INTERNAL_CONFIG_KEY} from '@next-translate-root/${configFileName}' | ||
| import AppDirI18nProvider from 'next-translate/AppDirI18nProvider' | ||
| import __loadNamespaces from 'next-translate/loadNamespaces' | ||
| import { getRequestNamespaces as __getRequestNamespaces } from 'next-translate/i18nRequestStore' |
There was a problem hiding this comment.
Avoid importing an entry point missing from supported runtimes
This template now emits next-translate/i18nRequestStore, but package.json still advertises next-translate >= 2.4.1 as a supported peer. The published 2.4.1 package does not ship that subpath, so projects on the currently-allowed peer range will start failing module resolution as soon as an App Router server page is transformed by this plugin. Please either raise the minimum supported next-translate version here or add a fallback for older runtimes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
You have reached your Codex usage limits. You can see your limits in the Codex usage dashboard.
Replace globalThis namespace merge with i18nRequestStore from next-translate. During static builds, each locale render now gets its own namespace accumulator via React.cache, preventing cross-locale pollution where namespaces from one locale leaked into another.