Add experimental.cachedNavigations feature flag#90928
Merged
unstubbable merged 1 commit intocanaryfrom Mar 6, 2026
Merged
Conversation
Collaborator
Tests Passed |
0784983 to
52f2534
Compare
Collaborator
Stats from current PR🔴 1 regression
📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles: **401 kB** → **401 kB** ✅ -36 B80 files with content-based hashes (individual files not comparable between builds) Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📝 Changed Files (9 files)Files with changes:
View diffsapp-page-exp..ntime.dev.jsfailed to diffapp-page-exp..time.prod.jsfailed to diffapp-page-tur..ntime.dev.jsfailed to diffapp-page-tur..time.prod.jsDiff too large to display app-page-tur..ntime.dev.jsfailed to diffapp-page-tur..time.prod.jsDiff too large to display app-page.runtime.dev.jsfailed to diffapp-page.runtime.prod.jsfailed to diffserver.runtime.prod.jsDiff too large to display 📎 Tarball URL |
52f2534 to
f696947
Compare
packages/next/src/client/components/router-reducer/fetch-server-response.ts
Outdated
Show resolved
Hide resolved
eafb189 to
97f89aa
Compare
acdlite
approved these changes
Mar 5, 2026
ce794f8 to
0325883
Compare
Contributor
|
Notifying the following users due to files changed in this PR based on this repo's notify modifiers: @timneutkens, @ijjk, @shuding, @huozhi: |
0325883 to
8f43e94
Compare
The recent Cached Navigations feature introduced navigation-level caching into the segment cache, where static and dynamic RSC data from navigations and initial HTML loads is cached so that repeat visits can be served instantly. This feature is currently gated behind `cacheComponents`, meaning it activates for all projects that enable Cache Components. This change introduces a new `experimental.cachedNavigations` flag that independently controls the Cached Navigations behavior. The flag defaults to `false` so we can investigate potential regressions that the feature might have introduced without affecting the broader Cache Components functionality. The flag requires `cacheComponents` to also be enabled and throws a configuration error if `cachedNavigations` is set without it. On the server, the staged rendering paths in `app-render.tsx` (both RSC request handling and initial HTML rendering) now check `cacheComponents && cachedNavigations` before producing staged responses. On the client, `process.env.__NEXT_CACHED_NAVIGATIONS` is used alongside `process.env.__NEXT_CACHE_COMPONENTS` for compile-time dead code elimination in the stream tee (`app-index.tsx`) and the response processing (`fetch-server-response.ts`). The cached navigations test suite enables the flag via `next.config.ts`, and the Cache Components CI jobs export `__NEXT_CACHED_NAVIGATIONS=true` to maintain test coverage.
8f43e94 to
cc6d3ba
Compare
sokra
pushed a commit
that referenced
this pull request
Mar 6, 2026
The recent Cached Navigations feature introduced navigation-level caching into the segment cache, where static and dynamic RSC data from navigations and initial HTML loads is cached so that repeat visits can be served instantly. This feature is currently gated behind `cacheComponents`, meaning it activates for all projects that enable Cache Components. This change introduces a new `experimental.cachedNavigations` flag that independently controls the Cached Navigations behavior. The flag defaults to `false` so we can investigate potential regressions that the feature might have introduced without affecting the broader Cache Components functionality. The flag requires `cacheComponents` to also be enabled and throws a configuration error if `cachedNavigations` is set without it. On the server, the staged rendering paths in `app-render.tsx` (both RSC request handling and initial HTML rendering) now check `cacheComponents && cachedNavigations` before producing staged responses. On the client, `process.env.__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS` is used alongside `process.env.__NEXT_CACHE_COMPONENTS` for compile-time dead code elimination in the stream tee (`app-index.tsx`) and the response processing (`fetch-server-response.ts`). The cached navigations test suite enables the flag via `next.config.ts`, and the Cache Components CI jobs export `__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS=true` to maintain test coverage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The recent Cached Navigations feature introduced navigation-level caching into the segment cache, where static and dynamic RSC data from navigations and initial HTML loads is cached so that repeat visits can be served instantly. This feature is currently gated behind
cacheComponents, meaning it activates for all projects that enable Cache Components.This change introduces a new
experimental.cachedNavigationsflag that independently controls the Cached Navigations behavior. The flag defaults tofalseso we can investigate potential regressions that the feature might have introduced without affecting the broader Cache Components functionality.The flag requires
cacheComponentsto also be enabled and throws a configuration error ifcachedNavigationsis set without it. On the server, the staged rendering paths inapp-render.tsx(both RSC request handling and initial HTML rendering) now checkcacheComponents && cachedNavigationsbefore producing staged responses. On the client,process.env.__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONSis used alongsideprocess.env.__NEXT_CACHE_COMPONENTSfor compile-time dead code elimination in the stream tee (app-index.tsx) and the response processing (fetch-server-response.ts).The cached navigations test suite enables the flag via
next.config.ts, and the Cache Components CI jobs export__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS=trueto maintain test coverage.