nextjs - 💡(How to fix) Fix Next 16.0: "Use cache" is ignored in dynamic routes [27 comments, 11 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#85240Fetched 2026-04-08 02:16:55
View on GitHub
Comments
27
Participants
11
Timeline
103
Reactions
15
Timeline (top)
subscribed ×49commented ×27mentioned ×16labeled ×4

Code Example

'use cache'

import {fakeAwait} from '@/utils/fakeAwait';

const Home = async ({ params }: { params: { locale: string } }) => {
  params = await params;
  await fakeAwait(2000);

  return (
    <div>
      <h1>locale: {params.locale}</h1>
    </div>
  )
}

export default Home;

---

- **Next.js Version**: 16.0.0
- **React Version**: 19.2.0
- **Node Version**: 22
- **Deployment Platform**: Vercel
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/leo-cheron/next16-cache

To Reproduce

  1. Create a Next.js 16 app with dynamic routes (e.g., app/[locale]/page.tsx)

File: app/[locale]/page.tsx

'use cache'

import {fakeAwait} from '@/utils/fakeAwait';

const Home = async ({ params }: { params: { locale: string } }) => {
  params = await params;
  await fakeAwait(2000);

  return (
    <div>
      <h1>locale: {params.locale}</h1>
    </div>
  )
}

export default Home;
  1. Add the 'use cache' directive at the top of the page or layout component
  2. Include async data fetching or delays to observe caching behavior
  3. Run locally with bun run dev:
    • Navigate to /en, /fr, etc.
    • Refresh the page multiple times
    • ✅ Expected: After first load, subsequent refreshes use cached data (instant load)
    • ✅ Actual: Cache works correctly, pages load instantly on refresh
  4. Build and deploy to production
  5. Navigate to the same dynamic routes in production: https://next16-cache.vercel.app/en-us
  6. Refresh the page multiple times
    • ✅ Expected: Cached data should be used, instant load times
    • ❌ Actual: Every refresh re-executes the entire component, ignoring the cache completely

Current vs. Expected behavior

Local Development (npm run dev): ✅ Works as expected

  • Cache is respected
  • Subsequent page loads are instant
  • fakeAwait(1000) delay only happens on first load

Production Build: ❌ Broken

  • Cache is ignored
  • Every page refresh re-executes the page
  • fakeAwait(1000) delay happens on every refresh
  • Suspense fallbacks are shown on every navigation/refresh

Provide environment information

- **Next.js Version**: 16.0.0
- **React Version**: 19.2.0
- **Node Version**: 22
- **Deployment Platform**: Vercel

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

Dynamic Routes

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

Vercel (Deployed)

Additional context

No response

extent analysis

TL;DR

The issue can likely be resolved by adjusting the caching configuration or the getStaticProps method for dynamic routes in the Next.js 16 application.

Guidance

  • Review the next.config.js file to ensure that caching is properly configured for dynamic routes.
  • Verify that the getStaticProps method is correctly implemented for the dynamic routes, as it may be overriding the caching behavior.
  • Check the Vercel deployment settings to ensure that caching is enabled and configured correctly for the production environment.
  • Consider adding logging or debugging statements to the fakeAwait function to determine if it's being called unnecessarily on every refresh.

Example

// Example of using getStaticProps for dynamic routes
export const getStaticProps = async ({ params }) => {
  // Pre-fetch data here if needed
  return {
    props: {
      // Pass pre-fetched data as props
    },
  };
};

Notes

The issue seems to be specific to the production environment on Vercel, which suggests that the problem might be related to the deployment configuration or the caching settings on the platform.

Recommendation

Apply workaround: Adjust the caching configuration and getStaticProps method to ensure proper caching behavior for dynamic routes in the production environment. This is recommended because the issue is likely related to the specific configuration of the application and the deployment platform, rather than a bug in the Next.js version being used.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING