fix: retry HTTP access fallbacks after router refresh - #97127
Draft
DavidIlie wants to merge 2 commits into
Draft
Conversation
Contributor
Tests PassedCommit: 0de4a8d |
Contributor
Stats from current PR✅ No significant changes detected📊 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
Server Middleware
Build DetailsBuild Manifests
Build Cache
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📝 Changed Files (6 files)Files with changes:
View diffsapp-page-exp..ntime.dev.jsfailed to diffapp-page-tur..ntime.dev.jsfailed to diffapp-page-tur..ntime.dev.jsfailed to diffapp-page.runtime.dev.jsfailed to diffpages-api.ru..time.prod.jsDiff too large to display pages.runtime.prod.jsDiff too large to display 📎 Tarball URLCommit: 0de4a8d |
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.
What?
Retry an HTTP access fallback when
router.refresh()supplies a new rendering attempt for the same pathname.Fixes #77086.
Why?
The HTTP access fallback boundary remembers a caught
notFound(),forbidden(), orunauthorized()result. It previously reset only when the pathname changed. A same-pathrouter.refresh()could return valid replacement RSC data while the boundary continued rendering the old fallback indefinitely.How?
Give the boundary an internal reset identity and derive it from the segment's RSC value. A refresh creates a new RSC attempt, while ordinary CacheNode cloning preserves the existing value and deferred completion resolves it in place. This retries the fallback only when new segment data is available, without remounting the preserved layout tree.
The regression fixture moves through
404 -> content -> 404 -> contentwithrouter.refresh(). It also verifies that the URL, root-layout state, and document identity remain stable.This is intentionally scoped to the same-path recovery case in #77086. It does not change Cache Components' rules for merging a complete prefetched segment with later dynamic data. #88802 and #93311 cover related navigation/search-parameter recovery cases.
Verification
pnpm --filter=next buildpnpm test-dev-turbo test/e2e/app-dir/http-access-fallback-refresh/http-access-fallback-refresh.test.tspnpm test-start-turbo test/e2e/app-dir/http-access-fallback-refresh/http-access-fallback-refresh.test.tspnpm test-dev-webpack test/e2e/app-dir/http-access-fallback-refresh/http-access-fallback-refresh.test.tspnpm test-start-webpack test/e2e/app-dir/http-access-fallback-refresh/http-access-fallback-refresh.test.ts