offline navigations: serve fallback document offline (5/10)#93627
Draft
feedthejim wants to merge 1 commit intofeedthejim/offline-navigations-service-worker-cachefrom
Draft
Conversation
This was referenced May 8, 2026
Contributor
Tests PassedCommit: 0c954ca |
77b9d6f to
d4c2b9b
Compare
33c0b95 to
4001039
Compare
Contributor
There was a problem hiding this comment.
Additional Suggestions:
- Inline snapshot in NFT test is missing the newly added
/node_modules/next/dist/build/offline-navigation-service-worker.jsentry, causing CI test failure.
- Inline snapshot in next-server-nft test is missing the new
/node_modules/next/dist/build/offline-navigation-service-worker.jstraced file, causing CI test failure.
4001039 to
829dcd8
Compare
d4c2b9b to
baf7074
Compare
829dcd8 to
1284032
Compare
baf7074 to
b445f31
Compare
1284032 to
f85d95c
Compare
b445f31 to
0e9f50a
Compare
This was referenced May 8, 2026
This was referenced May 8, 2026
Contributor
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
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.jsDiff too large to display app-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.jsDiff too large to display server.runtime.prod.jsDiff too large to display 📎 Tarball URLCommit: 0e9f50a |
f85d95c to
af1aeea
Compare
047192c to
b61869a
Compare
1583af3 to
ea10d83
Compare
b61869a to
609a8b3
Compare
ea10d83 to
fe9e691
Compare
1d279dc to
fd21d23
Compare
53e06ad to
7e1dae0
Compare
This was referenced May 10, 2026
fd21d23 to
7c7baff
Compare
14ed755 to
5a91f11
Compare
7c7baff to
141944b
Compare
5a91f11 to
cfe3cce
Compare
141944b to
1274b77
Compare
cfe3cce to
694e1d0
Compare
1274b77 to
b5b5f6c
Compare
b5b5f6c to
67131c2
Compare
694e1d0 to
1732a28
Compare
67131c2 to
0c954ca
Compare
1732a28 to
2cb2dd5
Compare
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.
Stack Position
This is PR 5 of 10. It makes the service worker serve the fallback document when a document request fails offline.
Review guide:
https://gist.github.com/feedthejim/a10f757cf07c5550f731adf2fcf1077b
Full Stack
offline navigations: add gated build primitives (1/10)offline navigations: generate fallback document artifacts (2/10)offline navigations: register pass-through worker (3/10)offline navigations: cache fallback and current-build assets (4/10)offline navigations: serve fallback document offline (5/10)offline navigations: add router-cache persistence primitives (6/10)offline navigations: persist cached router records (7/10)offline navigations: bootstrap fallback from router records (8/10)offline navigations: support dynamic route patterns (9/10)offline navigations: add docs and examples (10/10)What This Changes
This connects the cached fallback document to failed document requests. When a same-origin navigation cannot reach the server, the service worker can return the generated fallback HTML so the client app has a chance to boot and decide whether the requested route can be reconstructed.
At this point, the client router still cannot reconstruct route data. The expected user-visible behavior is a clear offline miss after the fallback boots.
What Works After This PR
Offline hard reloads can receive the fallback document instead of a browser network error. The UI can show an intentional miss when no router data has been persisted yet.
What Does Not Work Yet
The fallback document cannot restore a prefetched route until router-cache persistence and bootstrap replay land in PRs 6-8.
Reviewer Focus
Please focus on the request boundary: only failed document navigations should fall back to the generated document. The service worker should continue to avoid route semantics and RSC parsing.
Proof in This PR
Fallback document serving and visible miss behavior are covered by:
HEADLESS=true pnpm test-start-turbo test/production/app-dir/offline-navigations/offline-navigations.test.tsHEADLESS=true pnpm test-start-webpack test/production/app-dir/offline-navigations/offline-navigations.test.tsDeferred Coverage
PR 8 turns this fallback boot into successful route reconstruction when the normal client router has already cached the needed records.
Docs Status
The user-facing guide and config reference land in PR 10.