Commit 2bd31c8
[recovery] fix: setRequestLocale ordering in resources page (static→dynamic error)
The resources page called getTranslations("page-resources") before ever
calling setRequestLocale(locale), and generateMetadata never called it at
all. Bot/invalid paths like /api/resources are captured by the [locale]
catch-all with "api" as the locale segment. Since that isn't a valid
locale in generateStaticParams, the route renders on-demand and next-intl
reads the locale from request headers, opting the route into dynamic
rendering and throwing:
Error: Page changed from static to dynamic at runtime /api/resources,
reason: headers
Fix: call setRequestLocale(locale) first in both Page and generateMetadata,
before any next-intl API. Same fix class as the wallets/videos pages.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 77418ff commit 2bd31c8
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
237 | 239 | | |
238 | 240 | | |
239 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
240 | 245 | | |
241 | 246 | | |
242 | 247 | | |
| |||
0 commit comments