Skip to content

Cache components does not work on dynamic segments when localized #86870

@maxscn

Description

@maxscn

Link to the code that reproduces this issue

https://github.com/maxscn/intlayer-cache-components

To Reproduce

  1. Start the dev server.
  2. Go to /en/static (cached) and then /en/static/1 (not cached)
  3. Go to /static (cached) and then /static/1 (cached)

Current vs. Expected behavior

Following the steps, I expected the localized content to work exactly as the non-localized content. The locale is known at build time hence it should be possible to cache even the localized pages.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.1.0: Mon Oct 20 19:34:03 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8112
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 22.16.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.0.7 // Latest available version is detected (16.0.7).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

cacheComponents, internationalization (i18n)

Which stage(s) are affected? (Select all that apply)

next build (local), next dev (local), Vercel (Deployed)

Additional context

Every big localization framework which works with react server components (I have tried intlayer, next-intl and lingui), breaks when using it with cache components. The reason that they break seems to be that we are accessing params, which forces the route to be dynamic. Even if I cache the locale param at the layout level, when I access my params at page level I opt out since that is an asynchronous call. The result is that if you translate any content at all (in server components), your entire page becomes dynamic. All of the big localization framework demands that you do this to translate server side components.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Cache ComponentsRelated to the `cacheComponents`, `useCache`, or `ppr` experimental flags.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions