Skip to content

Commit f529f47

Browse files
pettinaripclaude
andcommitted
[recovery] fix: setRequestLocale ordering in wallets page (static→dynamic error)
The /wallets page (app/[locale]/wallets/page.tsx) called getTranslations("page-wallets") before setRequestLocale(locale), and generateMetadata never called setRequestLocale at all. For locales rendered on-demand — e.g. a bot probe like /api/wallets where "api" is captured as the [locale] param and is not covered by generateStaticParams — next-intl falls back to reading the locale from request headers. That opts the route into dynamic rendering and Next.js throws "Page changed from static to dynamic at runtime /api/wallets, reason: headers" (stack shows get requestLocale) instead of rendering statically. Call setRequestLocale(locale) first in both the page and generateMetadata, mirroring the fix in PR #18785 for the videos [slug] page. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 77418ff commit f529f47

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

app/[locale]/wallets/page.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ import heroImg from "@/public/images/wallets/wallet-hero.png"
4141
const Page = async (props: { params: Promise<PageParams> }) => {
4242
const params = await props.params
4343
const { locale } = params
44-
const t = await getTranslations("page-wallets")
4544

45+
// Set locale before next-intl APIs so on-demand renders stay static
4646
setRequestLocale(locale)
4747

48+
const t = await getTranslations("page-wallets")
49+
4850
// Get i18n messages
4951
const allMessages = await getMessages({ locale })
5052
const requiredNamespaces = getRequiredNamespacesForPage("/wallets")
@@ -386,6 +388,9 @@ export async function generateMetadata(props: {
386388
const params = await props.params
387389
const { locale } = params
388390

391+
// Set locale before next-intl APIs so on-demand renders stay static
392+
setRequestLocale(locale)
393+
389394
const t = await getTranslations("page-wallets")
390395

391396
return await getMetadata({

0 commit comments

Comments
 (0)