Skip to content

[recovery] fix: setRequestLocale ordering in wallets page (static→dynamic error)#18797

Open
pettinarip wants to merge 1 commit into
devfrom
recovery/fix/wallets-setrequestlocale-order
Open

[recovery] fix: setRequestLocale ordering in wallets page (static→dynamic error)#18797
pettinarip wants to merge 1 commit into
devfrom
recovery/fix/wallets-setrequestlocale-order

Conversation

@pettinarip

Copy link
Copy Markdown
Member

Error

[ERROR] Error: Page changed from static to dynamic at runtime /api/wallets, reason: headers
    ... at get requestLocale ...
  • URL: /api/wallets
  • Hit count: 1 (first seen 2026-06-02)
  • Function: ___netlify-server-handler

Root cause

/api/wallets is matched by app/[locale]/wallets/page.tsx with locale="api" — a bot/invalid path where api is captured as the [locale] dynamic segment. api is not a valid locale, so it is not produced by generateStaticParams and the route renders on-demand.

The page called getTranslations("page-wallets") before setRequestLocale(locale), and generateMetadata never called setRequestLocale at 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 throws Page changed from static to dynamic at runtime, reason: headers (stack shows get 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 and generateMetadata, mirroring #18785.

Affected files

  • app/[locale]/wallets/page.tsx

Verification

  • pnpm type-check — passes
  • pnpm exec eslint app/[locale]/wallets/page.tsx — clean

🤖 Generated with Claude Code

@pettinarip pettinarip added the recovery-agent Created by the Recovery Agent label Jul 14, 2026
@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit f529f47
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/6a57b6aaf4fa1400081d0039
😎 Deploy Preview https://deploy-preview-18797.ethereum.it
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 62 (🟢 up 6 from production)
Accessibility: 95 (no change from production)
Best Practices: 100 (no change from production)
SEO: 98 (no change from production)
PWA: 59 (🔴 down 1 from production)
View the detailed breakdown and full score reports

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>
@pettinarip pettinarip force-pushed the recovery/fix/wallets-setrequestlocale-order branch from 84d8bd7 to f529f47 Compare July 15, 2026 16:34
@pettinarip pettinarip marked this pull request as ready for review July 15, 2026 16:39
@pettinarip pettinarip requested a review from wackerow as a code owner July 15, 2026 16:39
@github-actions

Copy link
Copy Markdown
Contributor

🔎 First-pass review — ✅ Looks mergeable

Minimal, correct next-intl ordering fix: setRequestLocale(locale) now runs before any other next-intl API (getTranslations, getMessages) in both Page and generateMetadata. That's the right fix for the static → dynamic (reason: headers) error — without a locale set, next-intl reads the locale from request headers and forces on-demand dynamic rendering. Mirrors the established #18785 fix for the videos [slug] route.

Verified against the file: setRequestLocale was already imported (no import churn), no unused vars, and generateMetadata — which previously never set the locale at all — now does. Base branch dev and scope (single file, +6/−1) are appropriate.

Analysis
  • Lane: code (app/[locale]/wallets/page.tsx)
  • Checked: call ordering of next-intl APIs vs setRequestLocale; both Page and generateMetadata now call it first. No unused variables/params. No raw Intl.* introduced. No ChainName or component-variant surface touched. Imports clean.
  • Non-blocking: none.
  • CI: not asserted here — let the pipeline confirm; nothing in the diff should regress it.

Generated by PR Reviewer (team) for #18797 · 33 AIC · ⌖ 11.3 AIC · ⊞ 5.2K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

recovery-agent Created by the Recovery Agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant