-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Closed
Labels
Cache ComponentsRelated to the `cacheComponents`, `useCache`, or `ppr` experimental flags.Related to the `cacheComponents`, `useCache`, or `ppr` experimental flags.Dynamic RoutesRelated to dynamic routes.Related to dynamic routes.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.
Description
Link to the code that reproduces this issue
https://github.com/leo-cheron/next16-cache
To Reproduce
- 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;- Add the
'use cache'directive at the top of the page or layout component - Include async data fetching or delays to observe caching behavior
- 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
- Navigate to
- Build and deploy to production
- Navigate to the same dynamic routes in production: https://next16-cache.vercel.app/en-us
- 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**: VercelWhich 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
rshaul, septem1997, abdelkadersettah, afrinbhuiyan, timothylp and 7 more
Metadata
Metadata
Assignees
Labels
Cache ComponentsRelated to the `cacheComponents`, `useCache`, or `ppr` experimental flags.Related to the `cacheComponents`, `useCache`, or `ppr` experimental flags.Dynamic RoutesRelated to dynamic routes.Related to dynamic routes.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.