[recovery] fix: setRequestLocale ordering in wallets page (static→dynamic error)#18797
[recovery] fix: setRequestLocale ordering in wallets page (static→dynamic error)#18797pettinarip wants to merge 1 commit into
Conversation
✅ Deploy Preview for ethereumorg ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…amic 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>
84d8bd7 to
f529f47
Compare
🔎 First-pass review — ✅ Looks mergeableMinimal, correct next-intl ordering fix: Verified against the file: Analysis
|

Error
/api/wallets___netlify-server-handlerRoot cause
/api/walletsis matched byapp/[locale]/wallets/page.tsxwithlocale="api"— a bot/invalid path whereapiis captured as the[locale]dynamic segment.apiis not a valid locale, so it is not produced bygenerateStaticParamsand the route renders on-demand.The page called
getTranslations("page-wallets")beforesetRequestLocale(locale), andgenerateMetadatanever calledsetRequestLocaleat all. With no locale set, next-intl falls back to reading the locale from request headers, which opts the route into dynamic rendering. Next.js then throwsPage changed from static to dynamic at runtime, reason: headers(stack showsget requestLocale) instead of rendering statically / returning a clean response.This is the same bug class as the videos
[slug]page fixed in #18785 — a distinct route/URL, so a distinct fix.Fix
Call
setRequestLocale(locale)first (before any other next-intl API) in both the page component andgenerateMetadata, mirroring #18785.Affected files
app/[locale]/wallets/page.tsxVerification
pnpm type-check— passespnpm exec eslint app/[locale]/wallets/page.tsx— clean🤖 Generated with Claude Code