offline navigations: add router-cache persistence primitives (6/10)#93630
Draft
feedthejim wants to merge 1 commit intofeedthejim/offline-navigations-fallback-responsefrom
Draft
Conversation
Contributor
Tests PassedCommit: 363e3e7 |
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 (11 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 pages-api.ru..time.prod.jsDiff too large to display pages.runtime.prod.jsDiff too large to display server.runtime.prod.jsDiff too large to display 📎 Tarball URLCommit: 677c608 |
89e51eb to
d4f5ace
Compare
2d31917 to
a374727
Compare
d4f5ace to
f979b1a
Compare
a374727 to
140dad3
Compare
f979b1a to
f586a9b
Compare
f586a9b to
ca1a12e
Compare
This was referenced May 8, 2026
This was referenced May 8, 2026
ca1a12e to
c37f337
Compare
047192c to
b61869a
Compare
19af8b5 to
a0996c7
Compare
b61869a to
609a8b3
Compare
a0996c7 to
1d279dc
Compare
1d279dc to
fd21d23
Compare
c41688b to
4a20107
Compare
This was referenced May 10, 2026
fd21d23 to
7c7baff
Compare
9c58e11 to
e796c9e
Compare
7c7baff to
141944b
Compare
e796c9e to
677c608
Compare
1274b77 to
b5b5f6c
Compare
677c608 to
0054034
Compare
0054034 to
979db16
Compare
b5b5f6c to
67131c2
Compare
979db16 to
620f0a1
Compare
67131c2 to
0c954ca
Compare
620f0a1 to
363e3e7
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 6 of 10. It adds the client-side persistence primitives that later PRs use to mirror router-cache data into IndexedDB.
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 introduces the IndexedDB-backed offline navigation cache module. The module is intentionally a storage primitive, not a second router.
The durable format is deliberately small:
The storage does not persist live cache-map/LRU state, pending tasks, promises, decoded RSC values, response status/header metadata, or test-only request-key convenience fields.
What Works After This PR
The storage layer can be unit-tested in isolation. No production route writes or fallback boot reads are wired yet.
What Does Not Work Yet
The normal router does not persist its cached navigation records until PR 7. The fallback document does not read persisted records until PR 8.
Reviewer Focus
Please focus on whether the storage contract is the smallest durable backing format for the existing Segment Cache, whether route and segment invalidation mirror the regular router cache versions, and whether all invalid or unavailable states fail closed as misses.
Proof in This PR
Unit coverage for the persistence primitive is covered by:
pnpm jest --runTestsByPath packages/next/src/client/components/router-reducer/offline-navigation-cache.test.ts --runInBandThe current stack tip also passed:
git diff --checkpnpm --filter=next buildDeferred Coverage
PR 7 connects the primitive to real route and segment records. PR 8 proves the records can be used to reconstruct a hard reload and are cleared by normal router invalidation.
Docs Status
The user-facing guide and config reference land in PR 10.