Skip to content

Adopt partial prefetching - #1076

Open
oBusk wants to merge 5 commits into
mainfrom
partial-prefetching
Open

oBusk wants to merge 5 commits into
mainfrom
partial-prefetching

Conversation

@oBusk

@oBusk oBusk commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Adopts Partial Prefetching from Next.js 16.4. With it on, a default <Link> prefetches the route's static App Shell, which is shared by every link to that route, instead of each link prefetching its own URL.

Changes

  • Enable partialPrefetching: Next 16.4 warns when cacheComponents is on without it set, and it becomes the default in Next 17.
  • Skeleton fallback for [...parts]: the shell used to be an empty <Suspense>. It now has a skeleton shaped like the top of the diff page, so clicking any diff or catalog link paints immediately.
  • Remove prefetch={false} from the catalog's suggested diffs and the split/unified toggle. A default prefetch now only fetches the shared shell, so these opt-outs no longer prevent any server work.
  • prefetch={true} on the home page examples, only while the options are at their defaults. Each example gets a full prefetch from cached content. With custom options, typing in the Files field would trigger a fresh diff on the server for every keystroke, so those links fall back to the shell prefetch.
  • Prefetch the diff from the main form: when a version is picked in B's autocomplete and both A and B are exact versions, the page calls router.prefetch(url, { kind: "full" }). This is the same full prefetch as <Link prefetch={true}>, so pressing Diff is instant once it has finished (it skips custom options, like the examples).
  • ensureStatic = "navigation" on / and the /-/about pages, so the build fails if they accidentally become dynamic.

Testing (preview vs. production)

In DevTools, open the Network tab, filter on _rsc, and throttle to Slow 4G.

Check Production (before) Preview (expected)
Click the @types/node… example Skeleton, then the diff after a round trip Full diff immediately, with no request
Click lodash@4.17.0...4.17.21 Two round trips (redirect, then the page) Skeleton immediately, then one round trip
Type in Options → Files on the home page No prefetches No prefetches
Click a suggested diff on a catalog page (e.g. /is-even) Stays on the old page until the server responds URL changes and the skeleton shows immediately
Pick A and B from the autocompletes, wait a few seconds, press Diff Skeleton, then the diff Full diff immediately, with no request
Toggle Split/Unified on a diff page No skeleton No skeleton

Measured locally on a production build: about 100 ms from click to diff for the canonical example (before: about 700 ms), and about 50 ms from click to skeleton for catalog links.

Server cost: each home page view sends up to 4 extra requests for the example prefetches, which are normally cache hits. On a cold cache, such as right after a deploy, a prefetch computes the example diff, which the first click would have done anyway.

🤖 Generated with Claude Code

oBusk and others added 2 commits October 21, 2026 22:49
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
npm-diff Ready Ready Preview Oct 21, 2026 9:38pm UTC

oBusk and others added 3 commits October 22, 2026 22:37
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PLHpPQrKPUewGdqNgK98B6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Catalog and diff pages shared the [...parts] route, so its App Shell
painted a diff skeleton before every catalog page. Rewrite catalog-shaped
paths to an internal /-/catalog/[...parts] route with the catalog
skeleton as its shell, and redirect the internal path to the public one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PLHpPQrKPUewGdqNgK98B6
@oBusk
oBusk force-pushed the partial-prefetching branch from 3f61803 to e043a63 Compare October 22, 2026 20:50

This branch was successfully deployed

1 active (outdated) deployment
Preview — 3f618031 Deployed Oct 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant