Skip to content

Full Toolkit for Next-Level Domain Analysis

Adopt Cache Components 🧱⚑ (#131)

Felix Wotschofsky5126e176022e
diff --git a/.claude/skills/next-cache-components-adoption/SKILL.md b/.claude/skills/next-cache-components-adoption/SKILL.md
new file mode 100644
index 0000000..a035515
--- /dev/null
+++ b/.claude/skills/next-cache-components-adoption/SKILL.md
@@ -0,0 +1,250 @@
+---
+name: next-cache-components-adoption
+description: >
+ Turn on Cache Components in a Next.js app and resolve the blocking routes it
+ surfaces. Use when the user wants to enable, adopt, or migrate to Cache
+ Components, flip the `cacheComponents` flag, work through a flood of
+ blocking-prerender / instant validation errors, run the
+ `cache-components-instant-false` codemod, or decide between opting routes out
+ with `export const instant = false` and fixing them in place.
+---
+
+# next-cache-components-adoption
+
+Enable Cache Components on an app and walk it to a passing build. This skill sequences the work; per-error recipes live in the dev overlay fix cards and the build's terminal output. The [migrating to Cache Components guide](https://nextjs.org/docs/app/guides/migrating-to-cache-components) is the canonical reference for the concepts and per-API recipes this skill applies β€” consult it whenever the skill steps reference a pattern (`"use cache"`, `cacheLife`, `<Suspense>` placement, etc.) and you want the full explanation.
+
+## requires
+
+- **App Router project.** Cache Components is an App Router feature; `cacheComponents: true` does nothing for `pages/` routes. If the project has a `pages/` or `src/pages/` tree but no `app/` or `src/app/` tree, stop and tell the user β€” Pages β†’ App migration is its own project, not part of this skill. A hybrid app (both `pages/` and `app/`) is fine: the flag affects the `app/` routes; `pages/` routes are unaffected and don't need opt-outs.
+
+- **A resolved app directory.** Locate `next.config.{js,ts,mjs,cjs}` first: that's the project root, and an agent invoked from a subdirectory would otherwise test for `app/` against the wrong `cwd` and find nothing. Look for `app/` and `src/app/` under it, and treat every command and glob in this skill as relative to whichever one exists. If both exist, Next.js builds `app/` and never looks at `src/app/`, so its routes are shadowed and unbuilt β€” tell the user that and ask which tree to migrate instead of picking one.
+
+- **A runnable app.** The whole loop verifies against `next dev` and a browser, so the app has to boot. If it reads a database or required env at import (e.g. an `env.ts` that throws on a missing `DATABASE_URL`), confirm it actually starts β€” with the real environment, or local data you stand up β€” before step 1. Adoption can't be verified against an app that won't run.
+
+- **Next.js 16.3 or later.** That release is where the pieces this skill relies on land: top-level `cacheComponents`, `export const instant`, the dev-overlay instant-navigation validation warnings, and the `cache-components-instant-false` codemod. If `next --version` reports below 16.3, upgrade first:
+ - `npx @next/codemod@latest upgrade latest` to apply the version-to-version codemods.
+ - Read the relevant [version upgrade guide](https://nextjs.org/docs/app/guides/upgrading) (e.g. [Version 16](https://nextjs.org/docs/app/guides/upgrading/version-16)) for what the codemod doesn't cover.
+
+- **No incompatible config keys.** `cacheComponents: true` errors on any file that still exports `dynamic`, `revalidate`, or `fetchCache`. Inventory these exports before running the codemod, then follow the [migration guide's per-key sections](https://nextjs.org/docs/app/guides/migrating-to-cache-components). The guide is the source of truth for translating each value. The `cache-components-instant-false` codemod does not remove these configs.
+
+- **`experimental.dynamicIO` is fatal.** It was renamed to top-level `cacheComponents` and the old key now aborts before any build can run β€” remove it (or replace with `cacheComponents: true`) first. `experimental.useCache` is still accepted as a deprecated alias; redundant once `cacheComponents: true` is set, so remove it for clarity.
+
+### notes
+
+- **No passing baseline before the flag.** If the app already uses `"use cache"`, the pre-flag build errors with `please enable the feature flag cacheComponents`. Enabling the flag is the first thing you do (in Incremental, before the codemod; in Direct, before fixing routes) β€” not a thing to do _after_ getting a passing build. Note this in your starting summary so it doesn't read as a regression.
+
+- **Existing caches can stay.** Follow the migration guide's [`fetch` and `unstable_cache` sections](https://nextjs.org/docs/app/guides/migrating-to-cache-components#fetch-cache-options). Do not rewrite them solely to enable Cache Components.
+
+- **Offline docs.** Guide links have offline copies under `node_modules/next/dist/docs/` (bundled since Next.js 16.2), with the directory layout numbered for ordering (e.g. `node_modules/next/dist/docs/01-app/02-guides/migrating-to-cache-components.md`). If you can't predict the numbered prefix, `find node_modules/next/dist/docs -name '<slug>.md'` resolves it. The `/docs/messages/*` error pages are not bundled.
+
+- **Older versions without bundled docs.** Suggest `npx @next/codemod@latest agents-md` to the user before starting: it downloads a version-matched copy to `.next-docs/` and writes an index into `AGENTS.md`. It touches files in their repo, so ask first and run it only if they want it.
+
+## the shape of the work
+
+There's one loop: walk the route tree top-down, one feature at a time, adopting each route against `next dev` + a browser. The build is a final check for each feature, not the working surface.
+
+The choice in step 1 is whether to opt every route out of validation first or fix routes as you go. Either way the loop is the same:
+
+- **With a quiet pre-step (Incremental).** Run the codemod, fix what it can't, and fully migrate routes that previously required static rendering. Other routes keep their opt-outs for follow-up PRs.
+- **Without (Direct).** Enable `cacheComponents` and start the loop on whatever the build flags first. Same loop, but every fix sits on one branch until adoption is complete.
+
+In both, the per-route success bar is the same: **dev loop reports no errors AND `next build` passes**. Check in with the user after every feature, and suggest a commit but never make one without their confirmation. Expect to spend most of the time in the loop, not in the pre-step.
+
+## background
+
+`cacheComponents: true` requires every route to be prerenderable. A route that reads request-time data outside `<Suspense>` is "blocking" and fails the build. `export const instant = false` marks a route as allowed to block, which clears it in both dev and build; on a layout it covers the whole subtree during the build, but client navigations still validate each descendant segment on its own. Reads wrapped in a [`"use cache"`](https://nextjs.org/docs/app/api-reference/directives/use-cache) function count as cache boundaries, not blocking reads.
+
+When a fix introduces `"use cache"`, follow the Caching guide for [choosing a data-level or UI-level boundary and setting its lifetime](https://nextjs.org/docs/app/getting-started/caching#usage) and [revalidating after mutations](https://nextjs.org/docs/app/getting-started/revalidating). Use the [`use cache` cache-key reference](https://nextjs.org/docs/app/api-reference/directives/use-cache#cache-keys) when the result varies by arguments or captured values.
+
+Three classes of blocker come up, usually in this order:
+
+Whenever a fix introduces `<Suspense>`, follow the Streaming guide's [granular streaming pattern](https://nextjs.org/docs/app/guides/streaming#granular-streaming-with-suspense) and [guidance for preventing CLS](https://nextjs.org/docs/app/guides/streaming#cls-cumulative-layout-shift).
+
+1. **Request-time reads** (`cookies()`, `headers()`, `await params`, `await searchParams`). All four block when awaited at the top of a page or layout. `params` and `searchParams` often get missed because they're not framed as "request data" the way cookies and headers are. The fix is to push the read into a `<Suspense>`-wrapped child β€” and for `params`/`searchParams`, forward the promise into the child and await it there; don't `await` at the page top.
+2. **Sync-IO at module/render time** (`new Date()`, `Date.now()`, `Math.random()`, `crypto.randomUUID()`). These fail the build even with `instant = false` β€” the opt-out doesn't suppress them. If they're in a shared layout, they block every route under it. The codemod can't fix them; after running it, use each build error and its linked documentation to identify which reported calls to translate by hand (see the [incremental pre-step](#incremental)).
+3. **`"use cache"` files that read request data.** A file with a top-level `"use cache"` directive can't export `instant`; combining the two errors with `Only async functions are allowed to be exported in a "use cache" file.`, which means the directive was wrong for that route. Remove it before running the codemod.
+
+## working surfaces
+
+### finding blocking routes
+
+Prefer `next dev` over `next build` while you work.
+
+- **`next dev`** β€” the working surface. Visit a route; its blocking errors surface in the dev overlay with full stack traces and fix cards linking the per-error docs. Work one route at a time β€” errors don't accumulate in one place. The route itself still returns HTTP 200, so read the overlay (or `.next-dev.log`), not status codes. A cleared overlay is one half of calling a route clean β€” the other half is browser verification (see [step 2](#step-2-the-inner-loop-remove-opt-outs-one-feature-at-a-time)) and a passing build for that route.
+- **`next build`** β€” detection only. The build is `next dev`'s authoritative check, not its replacement. Use it as the last gate on each feature in the loop (a passing build is part of the per-route success bar) and as the final verification across the whole app. In Incremental, the build also confirms the pre-step (codemod opted every route out, no shared layout still has a sync-IO blocker) before you ship that PR. Don't reach for the build instead of the dev loop while you're working a route β€” a passing compile doesn't tell you what ended up in the static shell and what streamed. By default the build stops at the first blocking route, so it's also poor for sizing the work. Two flags help when iterating: `--debug-build-paths` builds only the routes you name (comma-separated glob patterns of file paths relative to the project root, e.g. `--debug-build-paths="app/admin/**/page.tsx"` β€” not URL paths; `--debug-build-paths="app/(marketing)/about/page.tsx"` β€” not `/about`; `--debug-build-paths="app/admin"` matches nothing and silently builds zero routes), and `--debug-prerender` disables the early exit so the build continues past the first prerender failure, reports every blocking route, and prints a fuller stack trace that names the originating file and line.
+
+Every blocking error has a docs page β€” open it. Both the dev overlay and the build terminal print a `https://nextjs.org/docs/messages/<slug>` link with each error. That page is the canonical recipe for the fix; the inline message is a summary. Fetch the link for every distinct error you encounter, even if you think you know the pattern β€” the recipes evolve, and the same error class can have different correct fixes depending on what the route reads. Don't improvise from the inline message alone. (`/docs/messages/*` pages aren't bundled offline; if you have no network, fall back to the per-API guides under `node_modules/next/dist/docs/` and note the limitation when you report back.)
+
+### verifying each fix at runtime
+
+A passing build or a cleared overlay isn't proof the route actually behaves β€” Cache Components is a runtime concern (a static shell with streamed data). Verify after every fix, not only at the end.
+
+In preference order:
+
+1. **[`next-dev-loop`](https://github.com/vercel/next.js/tree/canary/skills/next-dev-loop) β€” strongly preferred.** Cross-checks `/_next/mcp` against the live browser via `agent-browser` and surfaces both compile and runtime issues in one pass. The diagnostics (React tree, suspense boundaries, console + network) are richer than poking at `next dev` by hand.
+
+ Install it before starting the loop. Don't wait until you hit something `next dev` alone can't explain. It ships alongside this skill, so check whether it is already available first, and install it only if it is not:
+
+ ```bash
+ npx skills add https://github.com/vercel/next.js/tree/canary/skills/next-dev-loop
+ ```
+
+ The skill states its required `agent-browser` version and walks you through it.
+
+ **Requires Turbopack.** If `package.json`'s `dev` script passes `--webpack`, flag it to the user and ask whether there's a reason to stay on webpack. If not, switch to Turbopack (the Next.js 16.3+ default). If they want to keep webpack, skip this install and use the [build-only loop](#the-loop-build-only-fallback) instead.
+
+ You don't need permission to install `next-dev-loop` itself. It's a tool, like installing a dev dependency. If a user is present, briefly tell them you're installing it for verification. In a non-interactive run (CI, dashboard, sandbox), install it without asking β€” "can't prompt the user" is not a reason to skip. The only legitimate skip is a real technical blocker: no network, no npm, read-only filesystem, a stated no-new-deps policy, or a webpack-only dev script. If you skip, name the specific blocker in your final report.
+
+2. **A browser you can drive yourself.** Playwright, `agent-browser` directly, any browser-automation tool. Use only when `next-dev-loop` is genuinely blocked. You'll miss the framework-side checks (`/_next/mcp`), so DOM assertions alone don't catch every regression β€” be more cautious about what you call "verified."
+
+3. **Build-only.** If you can't run a dev server at all, the build is your only signal. `β—‹ (Static)` routes with no `<Suspense>` are fully verified by the build (nothing streamed to test). `◐ (Partial Prerender)` routes are only shell-verified β€” flag them when you report back.
+
+4. **No tooling at all.** Ask the user to run the dev server (or build) and report what they see, or hand off the milestone you've reached.
+
+## step 1: choose a strategy
+
+Ask the user, in terms of the PRs they want, not the size of the job. Never use the internal labels (Incremental, Direct) when talking to the user β€” those are your own scaffolding. Ask in terms of PRs and features, e.g.: _"Do you want me to first open a PR that turns on Cache Components and opts every route out of validation, then handle the actual route adoptions feature-by-feature in follow-up PRs? Or do everything on one branch?"_ Even on a tiny app, the incremental path still has value (review-sized PR, revertible, the `// TODO: Cache Components adoption` markers double as your work queue for next session). Don't pick on their behalf.
+
+If there's no user to ask, default to **Incremental** and document the choice.
+
+Honor an explicit choice in the request. If the user asks to migrate incrementally and also asks you to complete the migration, establish and verify the incremental checkpoint before continuing to the remaining routes in the same task. β€œComplete” sets the stopping point; it does not change the chosen strategy.
+
+- **Incremental** β€” quiet pre-step + the loop. Run the codemod to opt every page and layout out of validation, get the build passing, stop and check in with the user (see [end of the pre-step](#end-of-the-pre-step-check-in)), then enter [step 2's loop](#step-2-the-inner-loop-remove-opt-outs-one-feature-at-a-time) and ship each feature as a follow-up PR.
+- **Direct** β€” skip the pre-step. Enable `cacheComponents` and go straight to [step 2's loop](#step-2-the-inner-loop-remove-opt-outs-one-feature-at-a-time); the build's blocking routes are the work queue.
+
+### incremental
+
+Before invoking the codemod, grep for `^export const (revalidate|dynamic|fetchCache)` across the app directory and follow the migration guide for every match. Mark routes that use `dynamic = 'force-static'` or `dynamic = 'error'` for full migration in this PR. The codemod does not remove incompatible configs.
+
+The codemod refuses to run on a dirty working tree. Commit or stash unrelated work first, or pass `--force` to let its edits land alongside your WIP. Common false positive: if you recently upgraded Next.js, `package.json` and the lockfile will already be dirty β€” commit those first.
+
+```bash
+npx @next/codemod@latest cache-components-instant-false ./app
+```
+
+Pass the app directory you resolved in [requires](#requires). A wrong path is not an error: it reports `0 ok` and exits `0`, so read the file count and treat zero as a failed run, not an adopted app.
+
+Inserts `export const instant = false` (with a `// TODO: Cache Components adoption` comment) into every `{page,layout,default}` file under that directory, skipping files that already declare `instant` and any module marked `"use client"` or `"use server"`. Then set `cacheComponents: true`. The TODO comments are the work queue for the loop.
+
+If the codemod isn't available (older `@next/codemod`, sandboxed environment, offline run), reproduce it by hand: for every `{page,layout,default}.{js,jsx,ts,tsx}` in the app directory that isn't `"use client"` or `"use server"` and doesn't already declare `instant`, insert this after the imports:
+
+```ts
+// TODO: Cache Components adoption. Refactor this route so this opt-out can be removed.
+// See: https://nextjs.org/docs/app/guides/migrating-to-cache-components
+export const instant = false
+```
+
+The codemod opts every segment out, not only the root, on purpose. Resolution is top-down, first-explicit-config-wins: the highest `instant = false` decides the whole subtree. With an opt-out on every segment, removing one segment's opt-out validates only that segment; descendants keep their own opt-outs and stay passing. If only the root were opted out, removing it would re-arm validation for the entire app at once.
+
+Because the highest opt-out wins, remove them top-down (root layout first, then descend). Removing a leaf's opt-out does nothing while an ancestor still holds one.
+
+Remove the opt-outs from the previously static routes and any shared segments that mask their validation. Resolve their errors and confirm they still prerender. A cached data call alone does not prove the route remains static.
+
+Next, run `next build` to surface blockers the codemod could not handle. The build is the proof, not the codemod run β€” a shared layout that calls `new Date()` / `Math.random()` directly still fails regardless of the opt-out (see [background](#background)). If the normal build reports a sync-IO error without locating the call, rerun that route with `next build --debug-prerender --debug-build-paths="app/path/to/page.tsx"`. For each sync-IO error it reports:
+
+1. **Sync-IO at module/render time.** Use the route, originating file and line, and `/docs/messages/` link in the build output to locate the error. If needed, grep the whole repo for `new Date()`, `Date.now()`, `Math.random()`, and `crypto.randomUUID()` (not only `app/**/layout.{js,jsx,ts,tsx}` β€” the read might live in any component imported by a layout). Do not change unreported matches. Apply the appropriate option from the linked error page, then add this comment above a temporary boundary introduced only to unblock the build:
+
+ ```tsx
+ // TODO: Cache Components adoption. Added to unblock the build: remove this boundary to re-trigger the error and review the documented options.
+ ```
+
+ It shares the `TODO: Cache Components adoption` prefix with the comments the codemod writes, so the check-in grep finds both. Removing the boundary makes the error fire again with its fix cards β€” the same motion as removing an opt-out in the loop.
+
+After each fix, rerun the scoped build when available, then run `next build` again to find the next blocker. Repeat until the normal build passes.
+
+After the build passes, confirm every deferred route is still covered by an opt-out and no shared opt-out covers a previously static route. If the app has no previously static routes and the root layout remains deferred, confirm it got an opt-out (`grep -n "export const instant" <app dir>/layout.*`). The root layout renders every route, including framework routes like `/_not-found`, so if it was missed, add `export const instant = false` to it by hand.
+
+Synthetic routes like `/_not-found` have no user file β€” when they block, fix the root layout's opt-out, not the synthetic route. Client Components (`"use client"`) get no opt-out (it's a build error to export `instant` from them), but they are not a rare blocker. The high-frequency case is a client component in the root layout's nav or header calling `usePathname()`/`useSearchParams()`: it blocks _every_ dynamic route with `blocking-prerender-client-hook`, and static routes pass (the pathname is known at prerender), which masks it until you reach a dynamic segment. It's not an ancestor-data fix β€” follow the [error's docs page](https://nextjs.org/docs/messages/blocking-prerender-client-hook) for the `<Suspense>` recipe. Only when a client route blocks on _server_ data do you fix that data in its ancestor.
+
+### end of the pre-step: check in
+
+Incremental only. The pre-step is the shippable PR. Record the passing checkpoint before starting step 2. Unless the user already asked you to continue through the full migration in the same task, stop and check in. Talk to the user in their language; don't say "Incremental" or other internal labels; talk about adoption, PRs, and what the app does now. Tell them:
+
+- What you did: turned on Cache Components, ran the codemod, migrated the previously static routes, fixed the remaining blockers, and confirmed the build passes.
+- What changed: the previously static routes still prerender. Other pages and layouts keep a `// TODO: Cache Components adoption` opt-out.
+- What to sanity-check: the previously static routes stay fully prerendered and prefetchable, and request-specific data on the deferred routes remains request-specific.
+- The question: "Want to open this as its own PR before we start adopting Cache Components route by route? Or keep going on this branch?" Wait for the answer.
+
+If the user already asked you to complete the migration, continue after recording this checkpoint instead of asking the same question again.
+
+### direct
+
+Set `cacheComponents: true` and move to [step 2](#step-2-the-inner-loop-remove-opt-outs-one-feature-at-a-time). The build's blocking routes are the work queue.
+
+## step 2: the inner loop, remove opt-outs one feature at a time
+
+A "feature" is a single product surface β€” `app/settings/profile/**`, `app/posts/[slug]/**` β€” not a whole top-level app like `app/dashboard/**`. Finish one end-to-end before starting the next.
+
+Within a feature, walk top-down (layouts before pages, root layout first). Removing a layout's opt-out before its descendants exposes the layout's own blocking reads. (Direct: there are no opt-outs to remove β€” fix each failing route; if a hand-written opt-out on an ancestor shadows it, remove that first.)
+
+A passing build mid-walk doesn't mean the layout is clean. Removing a layout's opt-out while its descendant pages still have theirs keeps the build passing β€” each page shadows the inherited validation. The layout's actual blocking reads only surface once nothing below it shadows them. Don't call a feature done at the layout boundary.
+
+Use the **with-a-browser** loop unless a browser is genuinely unreachable. The [`next-dev-loop`](#verifying-each-fix-at-runtime) skill is the source of truth for what counts as "browser available" and how to install it.
+
+### the loop, with a browser (preferred)
+
+Per route:
+
+- Remove the opt-out (Incremental) or target the failing route (Direct).
+- Reload in dev. Overlay clean? Skip to verify. Overlay still red? Fix.
+- Fix β€” fetch the docs page linked from the error (`https://nextjs.org/docs/messages/<slug>`), apply the recipe from there. The inline overlay text is a summary; the docs page is the source of truth.
+- Verify in the browser. Confirm the visible content on first paint is what you intended in the shell β€” not stuck on a fallback, not silently streaming everything out of an empty shell.
+- Re-check siblings if the fix touched shared code (a layout, a sidebar component). A shared-shell change can fix the route you're on and break a sibling.
+
+### the loop, build-only (fallback)
+
+Used when there's no way to drive a browser β€” CI, sandbox, the user has no `next dev` running and you can't start one. Weaker signal: confirms the build passes and the route prerenders, but not what ended up in the static shell vs streamed.
+
+Per route:
+
+- Remove the opt-out (Incremental) or target the failing route (Direct).
+- Rebuild with `--debug-build-paths app/<route>/**` (only that route) or `--debug-prerender` (full build, but past the first failure). Route passing? Move on. Still blocking? Fix.
+- Fix β€” fetch the docs page linked from the error (`https://nextjs.org/docs/messages/<slug>`), apply the recipe from there.
+- Re-check siblings if the fix touched shared code.
+- Flag the route as build-only-verified when you hand the feature off. Each `◐` route still needs a browser pass before the feature is done.
+
+### loop notes
+
+- The [three blocker classes from background](#background) often get missed when fixing in place. Caching a downstream fetch (`getThing(id)`) doesn't clear an `await params` at the top of the page body β€” push the param promise into the `<Suspense>`-wrapped child.
+- Ambiguous calls are user check-ins, not agent judgment. When you're not sure which fix fits, the blocking code looks security-sensitive, or the user might want to keep the route blocking on purpose β€” read [references/per-page-decisions.md](./references/per-page-decisions.md) before editing. Show the route while you ask using `next-dev-loop`'s browser handoff, with a screenshot as the fallback. "Should this stay blocking?" is much easier to answer while looking at the page than at a file path.
+- Don't narrate the refactor with comments. The only comment the codemod (or you) should leave is `// TODO: Cache Components adoption` on opt-outs, and the user's existing comments. Don't annotate every `<Suspense>` boundary or `"use cache"` call with what it does β€” the code says that. Drop a comment only when the _why_ isn't clear from the code (e.g. a deliberate Block with a reason).
+- For many routes with the same mechanical fix, verify one representative route first. Then batch disjoint route groups using the same recipe, and run the shared build and browser checks together.
+
+Keep a todo list of the feature's routes. When every route in the feature is clean, move to step 3.
+
+## step 3: verify the feature
+
+Checklist before checking in with the user:
+
+- `next build` completes without blocking-route errors.
+- No bare TODOs in the feature: `grep -rn "TODO: Cache Components adoption"` finds both the codemod's opt-out comments and the sync-IO unblocks from the pre-step. Any `instant = false` left behind is a deliberate, documented Block β€” comment rewritten to a reason (see [references/per-page-decisions.md](./references/per-page-decisions.md) β†’ "when to leave a Block in place"). Any `await io()` or `await connection()` left behind has been reviewed and kept on purpose, not left over from the pre-step.
+- Each route visited in the browser: confirm the static shell renders first and every `<Suspense>` fallback resolves to its real content. Capture both states if you can β€” the fallback (mid-stream) and the final paint β€” so you have a streaming-experience demo to show the user. Throttle the network in the browser if streaming is too fast to observe.
+- After populating any new cache whose data can be updated, a mutation check confirms the next read returns the expected data.
+- If runtime verification fails, reproduce the same route on the pre-adoption branch or with its opt-out restored. A failure that already exists is an environment or data problem, not an adoption regression.
+
+Then check in with the user. Same rule as the pre-step: speak their language. Don't say "feature-by-feature loop" or other internal labels; talk about the feature you adopted and what the user will see.
+
+- What you did: which routes you touched, and the user-visible result per route (e.g. "the post page now streams the article body behind a skeleton while the layout stays static").
+- What changed: opt-outs removed, fallbacks added, caching boundaries introduced.
+- Show, don't tell. Follow `next-dev-loop`'s browser handoff and drive the route live so the user sees the static shell β†’ fallback β†’ final content sequence. If live presentation is unavailable, attach the before/after screenshots you captured.
+- Give them the click-through: a short table of the feature's routes β€” the URL to open and what to look for (what renders instantly, which fallbacks appear, what streams in) β€” so they can verify each one themselves.
+- The question: "Want to open this feature as a PR and move on to the next, or stop here?" Wait for the answer.
+
+**Trivial features can skip the check-in.** If adopting a feature only meant removing its `// TODO: Cache Components adoption` opt-out (no `<Suspense>` added, no `'use cache'` introduced, no render order change), the user sees nothing different. Move on to the next feature without stopping; mention it in passing the next time you do check in.
+
+When the loop has run on every feature β€” every remaining `instant = false` sits under a reason comment, `grep -rln "TODO: Cache Components adoption" app` returns nothing β€” point the user at [further reading](#further-reading) if they want to push the experience further, or stop and ship.
+
+### route table glyphs
+
+`Ζ’` β†’ `◐` is where adoption usually lands. `◐ (Partial Prerender)` means a static shell prerenders and the request-time content streams in β€” the goal state for any route that reads `cookies()`, `headers()`, `params`, or `searchParams`. Some routes legitimately stay `Ζ’` when they do request-time work through a documented escape hatch (e.g. a layout that uses `await connection()`); the page is no longer _opted out_, it's genuinely dynamic. Don't remove the escape hatch only to chase a `◐`. The inverse holds: `instant = false` does not force a route to be `Ζ’`. The glyph reflects what the route does at prerender time, not which validation knobs it exports.
+
+`◐` tells you a shell exists, not what's in it. A `<Suspense>` boundary placed too high (e.g. wrapping the entire page body, or `<Suspense fallback={null}>` around the article content) pushes the visible content out of the static shell into the streamed payload; the build still reports `◐` because _some_ shell prerendered (often only `<html><body>` with framework markup). The route table can't tell you what's in the shell; a browser can. If the shell is empty and everything streams, pull the `<Suspense>` boundary down closer to the actual dynamic read.
+
+## further reading
+
+The work below is optional and lives in the docs β€” link the user to them and let them decide which to take on next. Don't walk these through inside this skill.
+
+- [Sweep for more instant navigations](./references/dev-only-validations.md) β€” an optional follow-up once adoption is done, never required. A passing build is not the last word, because dev validates every route on each page load (simulating both page loads and client navigations) and catches what the build's first-error exit and descendant shadowing skipped. Offer it as the smaller path to instant navigation for a user who doesn't want to adopt Partial Prefetching. Adopting Partial Prefetching (below) runs the same kind of loop and meets these insights anyway, so recommend both and let the user pick which, or whether. The reference is the loop to execute.
+- [`next-partial-prefetching-adoption`](https://github.com/vercel/next.js/tree/canary/skills/next-partial-prefetching-adoption) β€” the follow-up skill that adopts Partial Prefetching: it enables `partialPrefetching` and audits every `<Link prefetch={true}>` against a decision table (or adopts incrementally with the flag off, driven by the `instant-link-prefetch-partial` insight). It sequences this the same way this skill sequences Cache Components, but the insights are dev-only, so it's a browser click-through, not a build loop. Recommended after instant navigation, since those fixes feed directly into how much of each route the shell can prefetch. Concepts live in the [Adopting Partial Prefetching guide](https://nextjs.org/docs/app/guides/adopting-partial-prefetching).
+- [Prevent regressions with e2e tests](https://nextjs.org/docs/app/guides/instant-navigation#prevent-regressions-with-e2e-tests) β€” the `@next/playwright` [`instant()`](https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config/instant#testing-instant-navigation) helper asserts on the UI that's available immediately on navigation, so regressions surface in CI. Recommend it once a route is instant: `next-dev-loop` confirms it _now_; an `instant()` test keeps it that way.
+- [`next-cache-components-optimizer`](https://github.com/vercel/next.js/tree/canary/skills/next-cache-components-optimizer) β€” a separate skill that grows each route's static shell so more of the page prerenders and less streams in. Pure optimization, not part of adoption.
diff --git a/.claude/skills/next-cache-components-adoption/references/dev-only-validations.md b/.claude/skills/next-cache-components-adoption/references/dev-only-validations.md
new file mode 100644
index 0000000..7c83fab
--- /dev/null
+++ b/.claude/skills/next-cache-components-adoption/references/dev-only-validations.md
@@ -0,0 +1,29 @@
+# dev-only validation sweep
+
+How to surface and fix the instant-navigation insights that a clean `next build` does not show. The [Instant navigation guide](https://nextjs.org/docs/app/guides/instant-navigation) is the canonical reference for the validation model this exercises.
+
+## what the build misses
+
+By default (`validationLevel: 'warning'`) Cache Components validates every Page and Default segment in `next dev`, and the insights land in the dev overlay's Insights tab, not the build. Validation runs on every page load using the real request, and for each route it independently checks the initial page load and client navigations at different points in the hierarchy. So a `<Suspense>` boundary that covers the page load can still leave a client navigation blocking, and a layout stays clean at build time while a descendant keeps its `instant = false`. The build stops at the first blocking route and does not raise this family by default. Loading each route in dev is what surfaces it.
+
+## when to run it
+
+After the Cache Components build is clean, not before. While the app is mid-adoption the build redboxes mask this, so a full clean build (every route `◐`, no errors) is the precondition. A quiet sweep is the expected result of a clean adoption, not a missing signal.
+
+## the loop
+
+Reuse the [`next-dev-loop`](https://github.com/vercel/next.js/tree/canary/skills/next-dev-loop) preflight (Turbopack), then add one job. On a webpack app, drive a browser directly with `agent-browser` or Playwright instead. You lose the `/_next/mcp` cross-checks, not the insights, which still show in the overlay and the dev log.
+
+1. Build a route queue from the last build's route table or the app directory.
+2. Load each route in `next dev` with a browser. A refresh or a link click both work, and validation simulates both the page-load and client-navigation cases on that load, so you do not need to click through every link by hand. Dynamic params are checked against the real values you visit, so hit a concrete `[slug]`, not the pattern.
+3. Watch the dev log and the Insights tab. The dev log is the greppable record, one `Error: Route "...": Next.js encountered ...` line per insight with its `docs/messages/<slug>` link, and it reads the same on Turbopack and webpack. The Insights tab is amber and appears only once an insight fires, so a route with no tab is clean. Through `next-dev-loop`'s `/_next/mcp`, these come from `get_errors` and the overlay, not `get_request_insights`, which is the performance recorder and reports nothing here.
+4. Open the linked page for each distinct insight and apply its fix (usually pull a `<Suspense>` boundary down to the read). Reload to confirm it clears.
+
+## gotchas
+
+- The overlay renders inside a shadow root (`nextjs-portal`), so accessibility-tree snapshots miss it. Read it through `shadowRoot`.
+- No browser, no sweep. There is no build-only fallback for this family. Apply the static fix you can from the docs page (gate on type-check) and hand off the live confirmation.
+
+## when this shrinks
+
+Build-time instant validation is opt-in today (`experimental.instantInsights.validationLevel: 'experimental-error'`); the default `'warning'` surfaces in the overlay only. Once the build raises these reliably, the sweep collapses into reading `next build` output and this reference can shrink to that.
diff --git a/.claude/skills/next-cache-components-adoption/references/per-page-decisions.md b/.claude/skills/next-cache-components-adoption/references/per-page-decisions.md
new file mode 100644
index 0000000..4e57a73
--- /dev/null
+++ b/.claude/skills/next-cache-components-adoption/references/per-page-decisions.md
@@ -0,0 +1,27 @@
+# per-page decisions: removing `instant = false`
+
+Read this when a route still blocks after you remove its `instant = false` and the dev overlay's fix card isn't enough on its own. Each section here covers a judgment call the agent shouldn't make alone.
+
+## deciding what to do with a blocking read
+
+Read the full linked page behind the fix card β€” not only the inline snippet β€” before editing. The card unblocks the build, but the page covers the details that make the route's navigation actually instant (e.g. where to place a `<Suspense>` boundary). Don't improvise.
+
+If you're unsure which fix fits, the right call usually depends on what this part of the page is _for_, which the code doesn't capture. Ask the user about their goal for it rather than guessing. Frame it as a product/UX question: should this content be there instantly on load, or is it fine for it to stream in a moment later? Should everyone see the same thing (cacheable) or is it per-user / per-request? Tie the technical fix to that answer (cache it, wrap it in `<Suspense>`, or keep it request-time), so they're deciding the experience, not the API.
+
+## security gates and other code you can't infer
+
+If the blocking code looks like it's there for a _reason you can't infer_ β€” a security gate at the page top (`await verifyAccess()`, an auth redirect, a feature-flag check) where moving it inside `<Suspense>` would change what the code guarantees β€” stop and ask the user before refactoring. The build error wants `<Suspense>`, but wrapping a gate in `<Suspense>` defeats the gate. Only the person who wrote it knows whether to keep the route blocking (`instant = false` as a documented Block), restructure the page so the gate runs differently, move the check to [Proxy](https://nextjs.org/docs/app/api-reference/file-conventions/proxy), or β€” if the gate duplicates protection the app already relies on elsewhere (platform auth such as Vercel Deployment Protection, a Proxy check, a Data Access Layer) β€” remove it.
+
+Relocating a read (`await connection()`, Proxy) only changes _where_ it runs, never _whether it should run at all_ β€” so a gate that's redundant or broken looks identical to a correctly-placed one through the fix card's lens. If a gate looks strange, redundant, or out of place, say so plainly β€” "this looks like it might be unnecessary here β€” are you sure it belongs?" β€” instead of quietly relocating it. Surfacing the doubt is the agent's job; deciding is the user's.
+
+If _every_ route under a layout is gated this way, a documented Block on the layout is the correct end state. Moving the gate to [Proxy](https://nextjs.org/docs/app/api-reference/file-conventions/proxy) is the architectural fix, not a Cache Components one, and that's a follow-up rather than something to hold the migration on.
+
+For the broader picture, read the [Authentication guide](https://nextjs.org/docs/app/guides/authentication) (where auth checks belong: Proxy for routing, Data Access Layer for data) and the [Data Access Layer section of Data Security](https://nextjs.org/docs/app/guides/data-security#data-access-layer) (centralized auth checks that compose with `'use cache'`).
+
+If you don't know how to make a piece of code Cache Components–correct without changing what it does, ask.
+
+## when to leave a Block in place
+
+If a route is genuinely meant to block β€” it's inherently per-request with no useful static shell β€” or the refactor would be large and the user would rather not take it on now, that's a legitimate outcome. Keep `instant = false`, but confirm it with the user first and turn its `// TODO: Cache Components adoption` comment into a reason, e.g. `// instant = false: kept on purpose β€” fully request-time dashboard` or `// instant = false: deferred, refactor too large for now`.
+
+A documented, deliberate Block is fine to leave after the migration; an undocumented leftover opt-out is not.
diff --git a/.claude/skills/next-dev-loop/SKILL.md b/.claude/skills/next-dev-loop/SKILL.md
new file mode 100644
index 0000000..c47aa64
--- /dev/null
+++ b/.claude/skills/next-dev-loop/SKILL.md
@@ -0,0 +1,207 @@
+---
+name: next-dev-loop
+description: >
+ Verify Next.js runtime behavior after editing app code. Use this
+ skill to confirm a change actually works in a running app β€” not
+ just that it compiles or type-checks. Combines /_next/mcp
+ (Next.js's view) with agent-browser (the browser's view).
+ Requires a running `next dev`.
+---
+
+# next-dev-loop
+
+The edit/verify rhythm during `next dev` β€” make a change, then
+confirm it actually works at runtime, not only that the types or
+the build are happy.
+
+You verify through two views of the same running app:
+
+- **`/_next/mcp`** β€” an HTTP endpoint Next.js exposes about itself.
+ Knows framework-specific things: routes, segments, RSC, server
+ actions, server logs, and errors as Next.js saw them. Call
+ `tools/list` for the current surface.
+- **`agent-browser`** β€” a CLI that drives a real Chrome. Knows
+ framework-agnostic browser things: DOM, console, network, React
+ fiber, vitals. Before driving it, run `agent-browser skills get core`
+ once for the version-matched usage guide β€” don't guess subcommands
+ from memory.
+
+The two views cross-check each other.
+
+## requires
+
+- Next.js **16.3+** with **Turbopack** β€” `/_next/mcp` plus the
+ proactive compile check via `get_compilation_issues`.
+- `agent-browser` **>= 0.31.1** β€” React introspection, worktree-scoped
+ `session id`, idempotent `--restore`, and launch flag reconciliation.
+
+These are hard floors, not soft preferences. If anything is missing,
+tell the user how to upgrade and stop. Don't fall back to grepping
+source or to a weaker probe β€” this skill assumes both views are live
+at the versions above.
+
+- Upgrade Next.js: `pnpm next upgrade` (or `npx next upgrade`).
+ Docs: https://nextjs.org/docs/app/getting-started/upgrading
+ (version-16 guide:
+ https://nextjs.org/docs/app/guides/upgrading/version-16)
+- Install or upgrade `agent-browser`: `npm i -g agent-browser@latest`.
+ If the CLI isn't on `PATH`, install it before continuing β€” preflight
+ expects to invoke it directly.
+
+## preflight
+
+Once per session, confirm both views are live.
+
+1. **Open `agent-browser` at the target URL, restoring saved
+ login state when present.** First derive one stable session id for
+ this checkout and use it for every `agent-browser` command:
+
+ ```bash
+ SESSION="$(agent-browser session id --scope worktree --prefix next-dev-loop)"
+ export AGENT_BROWSER_SESSION="$SESSION"
+ export AGENT_BROWSER_RESTORE="$SESSION"
+ ```
+
+ Then open the target URL:
+
+ ```bash
+ agent-browser --session "$SESSION" --restore --enable react-devtools open <url>
+ ```
+
+ `--scope worktree` keeps parallel worktrees and copied checkouts
+ from colliding. Bare `--restore` uses the session id as the
+ persistence key, loads saved cookies/localStorage before navigation
+ when present, and auto-saves state on close. Always pass the desired
+ launch flags on `open`; agent-browser will reuse, relaunch, or restart
+ its scoped background state as needed.
+
+ Keep routine verification headless. If the user asks to see the UI, open the
+ current URL in the coding harness's inline browser. It is a separate browser
+ context, so do not assume state carries over. When login or existing
+ `agent-browser` state must carry over, reopen that session headed instead:
+
+ ```bash
+ agent-browser --session "$SESSION" --restore --headed --enable react-devtools open <url>
+ ```
+
+ Pause while the user drives login, then continue with the same session and
+ keep it headed for the rest of the loop.
+
+2. Probe `/_next/mcp` (`tools/list`) β€” confirm it's reachable and
+ lists `get_compilation_issues`. First read the port off the
+ `next dev` banner; if it isn't 3000, set
+ `NEXT_MCP_URL=http://localhost:<port>/_next/mcp` before probing:
+ - Unreachable β†’ either `next dev` isn't running, or Next.js is
+ below 16.3. Check `package.json` to disambiguate, then refuse.
+ - `get_compilation_issues` not in the list β†’ Next.js below 16.3.
+ Refuse and tell the user to upgrade.
+3. `get_compilation_issues` doubles as a Turbopack probe. An error
+ response of `"Turbopack project is not available..."` means the
+ user is on webpack. Refuse β€” Turbopack is required.
+4. `get_routes` β†’ your route map for the rest of the session.
+
+## loop
+
+### before the edit β€” narrow the scope
+
+Ask the running app, not the codebase. `/_next/mcp` knows which
+files rendered the current route; use those as your search scope.
+Runtime introspection stays cheap as the codebase grows; agentic
+search doesn't.
+
+### after the edit β€” verify
+
+Four failure modes. Check each:
+
+- **Compiles** β€” `get_compilation_issues`.
+- **Runs without errors** β€” `/_next/mcp` (server and bubbled-up
+ browser errors both surface here).
+- **Behaves as intended** β€” `agent-browser` drives the page; assert
+ what the user actually sees.
+- **React-level behavior** β€” `agent-browser` with react-devtools
+ enabled exposes the component tree, props, state, and render
+ counts. Anchor framework-level checks here (extra renders,
+ server/client boundary shifts, suspense fallbacks) β€” DOM asserts
+ alone miss them.
+
+Pick the specific tool from `tools/list` or the agent-browser
+manual rather than from memory.
+
+## gotchas
+
+- **Preserve `.next` while the development server is running.** Moving or
+ deleting it disconnects the server from its generated state and discards
+ incremental caches. Moving it to a backup is still a reset. If a production
+ build needs isolated output, configure a separate `distDir`.
+- **Every `agent-browser` command must know your session and restore
+ key, or it may use an empty default browser or fail to save login
+ state.** Easiest: export both `AGENT_BROWSER_SESSION="$SESSION"` and
+ `AGENT_BROWSER_RESTORE="$SESSION"` at the top of each shell you run
+ agent-browser in. If you do not export them, pass
+ `--session "$SESSION" --restore` on every command.
+- **When the two views disagree, suspect the tooling first.** If
+ `agent-browser` says a route is broken but `/_next/mcp` and the
+ server say it rendered cleanly, a stale or misdirected browser
+ session is the likelier cause than a real bug β€” reconcile the views
+ before debugging the app.
+- Confirming a click or navigation: the page settles a beat later, so
+ wait with `wait --load networkidle` (no path to get wrong), then
+ snapshot/read to confirm the page. Avoid `wait --url` unless you pass
+ the link's exact href β€” a guessed or placeholder path won't match the
+ real URL and times out after 25s.
+- A blank read, empty snapshot, `about:blank`, or a "no browser
+ session" error β€” right after `open` or after a click (even if `open`
+ reported the page) β€” is the browser dropping the page (a stale
+ session), not a broken route. Reopen your session at the URL with the
+ same launch flags as the active loop, then re-snapshot. If still blank, run
+ `agent-browser --session "$SESSION" --restore close`, then reopen with
+ those same flags. Don't fall back to `curl`; it bypasses the browser
+ you're testing.
+- React introspection output is stale after navigation. Re-run.
+- `/_next/mcp` replies are SSE β€” read the JSON off the `data:` line
+ with `sed -n 's/^data: //p'` (a plain `sed 's/^data: //'` leaves the
+ `event:` line and the parse fails).
+- `get_errors` and `get_page_metadata` need at least one navigation
+ to populate.
+
+## reference
+
+All tools below are present once preflight passes. If `tools/list`
+is missing any of them, preflight should have refused β€” re-check.
+
+```
+# /_next/mcp notes
+get_project_metadata projectPath, devServerUrl, bundler
+get_routes fs-scan; no browser session needed
+get_errors runtime + build; needs a browser session;
+ includes browser-side errors caught by the
+ dev server
+get_page_metadata segment trie + routerType; needs a browser
+ session; use as a discovery shortcut for
+ which files power a route
+get_logs returns logFilePath
+get_server_action_by_id hashed id β†’ file + functionName
+get_compilation_issues Turbopack only; errors on webpack
+ ("Turbopack project is not available")
+```
+
+## teardown
+
+Close the session with the same session and restore context:
+`agent-browser --session "$SESSION" --restore close`. `close` saves
+that session's cookies and storage so the next loop's `--restore` open
+keeps the user logged in. Leave `next dev` up for the next loop.
+
+## Report Next.js friction
+
+Only participate in agent feedback when managed Next.js feedback instructions
+are already loaded for the project. Their presence means the feature is
+enabled; their absence means it is disabled.
+
+When enabled, add qualifying feedback candidates found during verification to
+the feedback candidate queue for the current user request, then continue
+verification. Do not run the feedback command or open review forms during the
+loop or at this Skill's teardown.
+
+The managed instructions own the single reporting pass immediately before the
+final response. If they are absent, do not queue or report feedback.
diff --git a/.prettierignore b/.prettierignore
index bd5535a..fab85f1 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1 +1,4 @@
pnpm-lock.yaml
+
+# Vendored agent skills, managed by skills-lock.json
+.claude/skills/
diff --git a/AGENTS.md b/AGENTS.md
index 643577d..af3b7c8 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,6 +1,6 @@
<!-- BEGIN:nextjs-agent-rules -->
-# This is NOT the Next.js you know
+## This is NOT the Next.js you know
This version has breaking changes β€” APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.
diff --git a/app/(landing)/_components/sponsors-section.tsx b/app/(landing)/_components/sponsors-section.tsx
index 1f993bc..486b4a3 100644
--- a/app/(landing)/_components/sponsors-section.tsx
+++ b/app/(landing)/_components/sponsors-section.tsx
@@ -1,3 +1,4 @@
+import { cacheLife } from 'next/cache';
import Image from 'next/image';
import { type FC, type HTMLAttributes } from 'react';
@@ -12,13 +13,23 @@ import {
import { getAllSponsors } from '@/lib/sponsors';
import { cn } from '@/lib/utils';
+// getAllSponsors also runs from next.config.ts, outside any request, where
+// cacheLife() would throw, so the cache boundary lives here instead.
+const getCachedSponsors = async () => {
+ 'use cache';
+ // Daily like the old route revalidate. Expire stays at the default (never),
+ // unlike the days profile's 1 week
+ cacheLife({ revalidate: 60 * 60 * 24 });
+ return getAllSponsors();
+};
+
type SponsorsSectionProps = HTMLAttributes<HTMLElement>;
export const SponsorsSection: FC<SponsorsSectionProps> = async ({
className,
...props
}) => {
- const allSponsors = await getAllSponsors();
+ const allSponsors = await getCachedSponsors();
if (!allSponsors.length) {
return null;
diff --git a/app/(landing)/certs/page.tsx b/app/(landing)/certs/page.tsx
index f65941c..963f23b 100644
--- a/app/(landing)/certs/page.tsx
+++ b/app/(landing)/certs/page.tsx
@@ -6,8 +6,6 @@ import { AuthorSection } from '../_components/author-section';
import { SponsorsSection } from '../_components/sponsors-section';
import { TrustSection } from '../_components/trust-section';
-export const revalidate = 86400; // 24 hours
-
export const metadata: Metadata = {
title: 'Certificate Search',
openGraph: {
diff --git a/app/(landing)/dnssec/page.tsx b/app/(landing)/dnssec/page.tsx
index 13da305..4e862f1 100644
--- a/app/(landing)/dnssec/page.tsx
+++ b/app/(landing)/dnssec/page.tsx
@@ -6,8 +6,6 @@ import { AuthorSection } from '../_components/author-section';
import { SponsorsSection } from '../_components/sponsors-section';
import { TrustSection } from '../_components/trust-section';
-export const revalidate = 86400;
-
export const metadata: Metadata = {
title: 'DNSSEC Lookup',
openGraph: {
diff --git a/app/(landing)/map/page.tsx b/app/(landing)/map/page.tsx
index 06236e1..155ff69 100644
--- a/app/(landing)/map/page.tsx
+++ b/app/(landing)/map/page.tsx
@@ -6,8 +6,6 @@ import { AuthorSection } from '../_components/author-section';
import { SponsorsSection } from '../_components/sponsors-section';
import { TrustSection } from '../_components/trust-section';
-export const revalidate = 86400; // 24 hours
-
export const metadata: Metadata = {
title: 'DNS Propagation Map',
openGraph: {
diff --git a/app/(landing)/opengraph-image.tsx b/app/(landing)/opengraph-image.tsx
index 5451a05..3cd9c92 100644
--- a/app/(landing)/opengraph-image.tsx
+++ b/app/(landing)/opengraph-image.tsx
@@ -1,6 +1,7 @@
import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
+import { cacheLife } from 'next/cache';
import { ImageResponse } from 'next/og';
export const contentType = 'image/png';
@@ -8,7 +9,12 @@ export const contentType = 'image/png';
const fetchArrayBuffer = async (url: string | URL) =>
fetch(url).then((res) => res.arrayBuffer());
-export const handler = async () => {
+// Cached so the image still prerenders; uncached fetches would render it on
+// every request
+const getAssets = async () => {
+ 'use cache';
+ cacheLife('max');
+
const [interRegularFont, interBoldFont, globeImage] = await Promise.all([
fetchArrayBuffer(
'https://fonts.bunny.net/inter/files/inter-latin-400-normal.woff',
@@ -16,9 +22,15 @@ export const handler = async () => {
fetchArrayBuffer(
'https://fonts.bunny.net/inter/files/inter-latin-700-normal.woff',
),
- readFile(join(process.cwd(), 'assets/globe.png')),
+ readFile(join(process.cwd(), 'assets/globe.png'), 'base64'),
]);
+ return { interRegularFont, interBoldFont, globeImage };
+};
+
+export const handler = async () => {
+ const { interRegularFont, interBoldFont, globeImage } = await getAssets();
+
return new ImageResponse(
<div
style={{
@@ -152,7 +164,7 @@ export const handler = async () => {
{/* eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text */}
<img
- src={`data:image/png;base64,${globeImage.toString('base64')}`}
+ src={`data:image/png;base64,${globeImage}`}
width={1000}
style={{
position: 'absolute',
diff --git a/app/(landing)/page.tsx b/app/(landing)/page.tsx
index 1defb53..bfac7ef 100644
--- a/app/(landing)/page.tsx
+++ b/app/(landing)/page.tsx
@@ -6,8 +6,6 @@ import { FeaturesSection } from './_components/features-section';
import { SponsorsSection } from './_components/sponsors-section';
import { TrustSection } from './_components/trust-section';
-export const revalidate = 86400; // 24 hours
-
export const metadata = {
openGraph: {
url: '/',
diff --git a/app/(landing)/subdomains/page.tsx b/app/(landing)/subdomains/page.tsx
index 405ae1e..b306a91 100644
--- a/app/(landing)/subdomains/page.tsx
+++ b/app/(landing)/subdomains/page.tsx
@@ -6,8 +6,6 @@ import { AuthorSection } from '../_components/author-section';
import { SponsorsSection } from '../_components/sponsors-section';
import { TrustSection } from '../_components/trust-section';
-export const revalidate = 86400; // 24 hours
-
export const metadata: Metadata = {
title: 'Subdomain Search',
openGraph: {
diff --git a/app/(landing)/whois/page.tsx b/app/(landing)/whois/page.tsx
index 5b4b40c..16a80c8 100644
--- a/app/(landing)/whois/page.tsx
+++ b/app/(landing)/whois/page.tsx
@@ -6,8 +6,6 @@ import { AuthorSection } from '../_components/author-section';
import { SponsorsSection } from '../_components/sponsors-section';
import { TrustSection } from '../_components/trust-section';
-export const revalidate = 86400; // 24 hours
-
export const metadata: Metadata = {
title: 'WHOIS Lookup',
openGraph: {
diff --git a/app/_components/search-form.test.tsx b/app/_components/search-form.test.tsx
new file mode 100644
index 0000000..d3c3f68
--- /dev/null
+++ b/app/_components/search-form.test.tsx
@@ -0,0 +1,72 @@
+import { act, Activity } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { SearchForm } from './search-form';
+
+const router = vi.hoisted(() => ({ push: vi.fn(), refresh: vi.fn() }));
+
+vi.mock('next/navigation', () => ({
+ useRouter: () => router,
+ usePathname: () => '/',
+ useParams: () => ({}),
+ useSelectedLayoutSegment: () => null,
+}));
+vi.mock('swr/immutable', () => ({ default: () => ({ data: undefined }) }));
+vi.mock('@/lib/analytics', () => ({
+ useAnalytics: () => ({ reportEvent: vi.fn() }),
+}));
+vi.mock('./ip-details-modal', () => ({ IpDetailsModal: () => null }));
+
+describe('search form', () => {
+ let container: HTMLDivElement;
+ let root: Root;
+
+ beforeEach(() => {
+ vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true);
+ router.push.mockReset();
+ container = document.createElement('div');
+ document.body.append(container);
+ root = createRoot(container);
+ });
+
+ afterEach(async () => {
+ await act(async () => root.unmount());
+ container.remove();
+ vi.unstubAllGlobals();
+ });
+
+ const render = async (mode: 'visible' | 'hidden') => {
+ await act(async () =>
+ root.render(
+ <Activity mode={mode}>
+ <SearchForm autofocus={false} />
+ </Activity>,
+ ),
+ );
+ };
+
+ // Navigating away hides the page with Activity instead of unmounting it, so
+ // pressing Back shows the same form instance again rather than a fresh one
+ it('can search again after navigating back to it', async () => {
+ await render('visible');
+ const input = container.querySelector<HTMLInputElement>('input')!;
+
+ await act(async () => {
+ Object.getOwnPropertyDescriptor(
+ HTMLInputElement.prototype,
+ 'value',
+ )!.set!.call(input, 'example.com');
+ input.dispatchEvent(new Event('input', { bubbles: true }));
+ });
+ await act(async () => input.form!.requestSubmit());
+
+ expect(router.push).toHaveBeenCalledWith('/lookup/example.com');
+ expect(input.disabled).toBe(true);
+
+ await render('hidden');
+ await render('visible');
+
+ expect(input.disabled).toBe(false);
+ });
+});
diff --git a/app/_components/search-form.tsx b/app/_components/search-form.tsx
index 1dbd2d7..8a748c7 100644
--- a/app/_components/search-form.tsx
+++ b/app/_components/search-form.tsx
@@ -15,6 +15,7 @@ import {
type KeyboardEventHandler,
type MouseEventHandler,
useEffect,
+ useLayoutEffect,
useRef,
useState,
} from 'react';
@@ -188,6 +189,18 @@ export const SearchForm: FC<SearchFormProps> = (props) => {
null,
);
+ // Navigating away hides the page instead of unmounting it, so reset the
+ // submit state here or the form is still disabled when the user goes back
+ useLayoutEffect(
+ () => () => {
+ setState(FormStates.Initial);
+ setSuggestionsVisible(false);
+ setSelectedSuggestion(null);
+ setIpDetailsOpen(false);
+ },
+ [],
+ );
+
const handleSelectSuggestion = (value: typeof SUGGESTION_OWN_IP | string) => {
setState(FormStates.Initial);
setSuggestionsVisible(false);
diff --git a/app/lookup/[domain]/(dns)/page.tsx b/app/lookup/[domain]/(dns)/page.tsx
index 1f96751..1e6cca2 100644
--- a/app/lookup/[domain]/(dns)/page.tsx
+++ b/app/lookup/[domain]/(dns)/page.tsx
@@ -43,8 +43,6 @@ export const generateMetadata = async ({
};
};
-export const fetchCache = 'default-no-store';
-
const DnsResultsPage: FC<DnsResultsPageProps> = async ({
params,
searchParams,
diff --git a/app/lookup/[domain]/_components/lookup-header.test.tsx b/app/lookup/[domain]/_components/lookup-header.test.tsx
new file mode 100644
index 0000000..0e9d9ca
--- /dev/null
+++ b/app/lookup/[domain]/_components/lookup-header.test.tsx
@@ -0,0 +1,76 @@
+import { PathParamsContext } from 'next/dist/shared/lib/hooks-client-context.shared-runtime';
+import { act, Activity, Component, type ReactNode } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { LookupHeader } from './lookup-header';
+
+vi.mock('./domain-summary', () => ({ DomainSummary: () => null }));
+vi.mock('./related-domains', () => ({ RelatedDomains: () => null }));
+vi.mock('./results-tabs', () => ({ ResultsTabs: () => null }));
+vi.mock('./share-button', () => ({ ShareButton: () => null }));
+
+const errors: unknown[] = [];
+
+// Stands in for app/error.tsx, which sits inside the hidden page
+class ErrorBoundary extends Component<
+ { children: ReactNode },
+ { failed: boolean }
+> {
+ state = { failed: false };
+ static getDerivedStateFromError = (error: unknown) => {
+ errors.push(error);
+ return { failed: true };
+ };
+ render = () => (this.state.failed ? null : this.props.children);
+}
+
+describe('lookup header', () => {
+ let container: HTMLDivElement;
+ let root: Root;
+
+ beforeEach(() => {
+ vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true);
+ errors.length = 0;
+ container = document.createElement('div');
+ document.body.append(container);
+ root = createRoot(container);
+ });
+
+ afterEach(async () => {
+ await act(async () => root.unmount());
+ container.remove();
+ vi.unstubAllGlobals();
+ });
+
+ // Like layout-router: navigating to a landing page hides the lookup page
+ // with Activity instead of unmounting it, while useParams switches to the
+ // landing URL's params
+ const render = async (params: { domain?: string }) => {
+ const onLookup = 'domain' in params;
+ await act(async () =>
+ root.render(
+ <PathParamsContext.Provider value={params}>
+ <Activity mode={onLookup ? 'visible' : 'hidden'}>
+ <ErrorBoundary>
+ <LookupHeader />
+ </ErrorBoundary>
+ </Activity>
+ <Activity mode={onLookup ? 'hidden' : 'visible'}>
+ <p>landing</p>
+ </Activity>
+ </PathParamsContext.Provider>,
+ ),
+ );
+ };
+
+ it('renders nothing while hidden on a page without a domain', async () => {
+ await render({ domain: 'example.com' });
+ expect(container.querySelector('h1')?.textContent).toContain('example.com');
+
+ await render({});
+
+ expect(errors).toEqual([]);
+ expect(container.querySelector('h1')).toBeNull();
+ });
+});
diff --git a/app/lookup/[domain]/_components/lookup-header.tsx b/app/lookup/[domain]/_components/lookup-header.tsx
new file mode 100644
index 0000000..407bf6c
--- /dev/null
+++ b/app/lookup/[domain]/_components/lookup-header.tsx
@@ -0,0 +1,58 @@
+'use client';
+
+import { ExternalLinkIcon } from 'lucide-react';
+import { useParams } from 'next/navigation';
+import type { FC } from 'react';
+
+import { isWildcardDomain } from '@/lib/utils';
+
+import { DomainSummary } from './domain-summary';
+import { RelatedDomains } from './related-domains';
+import { ResultsTabs } from './results-tabs';
+import { ShareButton } from './share-button';
+
+// Reads the domain from the URL, so a client navigation renders it right away
+// instead of waiting for the server
+export const LookupHeader: FC = () => {
+ const { domain } = useParams<{ domain?: string }>();
+
+ // A lookup page hidden by Activity re-renders with the current URL's
+ // params, which have no domain while a landing page is shown
+ if (!domain) return null;
+
+ return (
+ <>
+ <div className="container space-y-6 pt-12 pb-8">
+ <div className="flex w-full items-center gap-4">
+ {/* Bottom padding added to avoid clipping */}
+ <h1 className="mb-2 flex-1 overflow-hidden pb-1 break-words">
+ <span className="block text-zinc-500 dark:text-zinc-400">
+ Results for
+ </span>
+ {isWildcardDomain(domain) ? (
+ <span className="block text-4xl font-bold">{domain}</span>
+ ) : (
+ <a
+ className="block text-4xl font-bold"
+ href={`https://${domain}`}
+ target="_blank"
+ rel="noreferrer nofollow"
+ >
+ {domain} <ExternalLinkIcon className="inline-block" />
+ </a>
+ )}
+ </h1>
+
+ <ShareButton />
+ </div>
+
+ <RelatedDomains domain={domain} />
+ <DomainSummary domain={domain} />
+ </div>
+
+ <div className="container">
+ <ResultsTabs domain={domain} />
+ </div>
+ </>
+ );
+};
diff --git a/app/lookup/[domain]/layout.tsx b/app/lookup/[domain]/layout.tsx
index 6a1c4c3..69b2131 100644
--- a/app/lookup/[domain]/layout.tsx
+++ b/app/lookup/[domain]/layout.tsx
@@ -1,21 +1,17 @@
-import { ExternalLinkIcon } from 'lucide-react';
import type { Metadata } from 'next';
import dynamic from 'next/dynamic';
import { notFound } from 'next/navigation';
-import { type FC, type ReactNode } from 'react';
+import { type FC, type ReactNode, Suspense } from 'react';
import { Card } from '@/components/ui/card';
import { ClientOnly } from '@/components/client-only';
-import { isValidDomain, isWildcardDomain } from '@/lib/utils';
+import { isValidDomain } from '@/lib/utils';
import { Footer } from '../../_components/footer';
import { Header } from '../../_components/header';
import { CarbonAdRail } from './_components/carbon-ad';
-import { DomainSummary } from './_components/domain-summary';
-import { RelatedDomains } from './_components/related-domains';
-import { ResultsTabs } from './_components/results-tabs';
-import { ShareButton } from './_components/share-button';
+import { LookupHeader } from './_components/lookup-header';
const StarReminder = dynamic(() =>
import('./_components/star-reminder').then((m) => ({
@@ -44,70 +40,53 @@ export const generateMetadata = async ({
};
};
-const LookupLayout: FC<LookupLayoutProps> = async (props) => {
- const params = await props.params;
-
- const { domain } = params;
+type DomainCheckProps = {
+ params: LookupLayoutProps['params'];
+};
- const { children } = props;
+// Streamed responses have already sent a 200 by the time this runs, so an
+// invalid domain gets the not-found UI with a 200 status (a soft 404). For a
+// real 404, validate the domain in proxy.ts before rendering starts instead.
+const DomainCheck: FC<DomainCheckProps> = async ({ params }) => {
+ const { domain } = await params;
if (!isValidDomain(domain)) {
return notFound();
}
- return (
- <>
- <Header showSearch={true} />
- <main className="flex w-full flex-1 flex-col">
- <div className="container space-y-6 pt-12 pb-8">
- <div className="flex w-full items-center gap-4">
- {/* Bottom padding added to avoid clipping */}
- <h1 className="mb-2 flex-1 overflow-hidden pb-1 break-words">
- <span className="block text-zinc-500 dark:text-zinc-400">
- Results for
- </span>
- {isWildcardDomain(domain) ? (
- <span className="block text-4xl font-bold">{domain}</span>
- ) : (
- <a
- className="block text-4xl font-bold"
- href={`https://${domain}`}
- target="_blank"
- rel="noreferrer nofollow"
- >
- {domain} <ExternalLinkIcon className="inline-block" />
- </a>
- )}
- </h1>
-
- <ShareButton />
- </div>
-
- <RelatedDomains domain={domain} />
- <DomainSummary domain={domain} />
- </div>
-
- <div className="container">
- <ResultsTabs domain={domain} />
- </div>
-
- <div className="flex flex-1 flex-col p-3">
- <Card className="flex-1 py-8">
- <div className="container flex gap-8 px-5 min-[1400px]:max-w-[calc(1400px-2*.75rem)]">
- <div className="min-w-0 flex-1">{children}</div>
-
- <CarbonAdRail />
- </div>
- </Card>
- </div>
- </main>
- <Footer />
-
- <ClientOnly>
- <StarReminder />
- </ClientOnly>
- </>
- );
+ return null;
};
+// The lookup header and tabs read the domain from the URL on the client, so a
+// client navigation renders them at once. A full page load renders them with
+// the request instead of prerendering skeletons for them.
+const LookupLayout: FC<LookupLayoutProps> = ({ children, params }) => (
+ <Suspense>
+ <Header showSearch={true} />
+ <main className="flex w-full flex-1 flex-col">
+ {/* Separate boundary so waiting for the server doesn't hold the page */}
+ <Suspense>
+ <DomainCheck params={params} />
+ </Suspense>
+
+ <LookupHeader />
+
+ <div className="flex flex-1 flex-col p-3">
+ <Card className="flex-1 py-8">
+ <div className="container flex gap-8 px-5 min-[1400px]:max-w-[calc(1400px-2*.75rem)]">
+ <div className="min-w-0 flex-1">{children}</div>
+
+ <CarbonAdRail />
+ </div>
+ </Card>
+ </div>
+ </main>
+ <Footer />
+
+ <ClientOnly>
+ <StarReminder />
+ </ClientOnly>
+ </Suspense>
+);
+
export default LookupLayout;
diff --git a/app/sitemap.ts b/app/sitemap.ts
index a5fda0b..fa6a04a 100644
--- a/app/sitemap.ts
+++ b/app/sitemap.ts
@@ -1,4 +1,5 @@
import type { MetadataRoute } from 'next';
+import { cacheLife } from 'next/cache';
import { parse as parseTldts } from 'tldts';
import { env } from '@/env';
@@ -29,7 +30,12 @@ const getProgrammaticPaths = async () => {
return resultsPaths;
};
+// Cached so the sitemap is still prerendered instead of querying BigQuery on
+// every request
const sitemap = async (): Promise<MetadataRoute.Sitemap> => {
+ 'use cache';
+ cacheLife('max');
+
if (!env.SITE_URL) {
return [];
}
diff --git a/next.config.ts b/next.config.ts
index 86d7a40..658d8c0 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -3,6 +3,8 @@ import type { NextConfig } from 'next';
import { getSponsorImageRemotePatterns } from './lib/sponsors';
const nextConfig = async (): Promise<NextConfig> => ({
+ cacheComponents: true,
+ partialPrefetching: false,
reactStrictMode: false,
turbopack: {
rules: {
diff --git a/skills-lock.json b/skills-lock.json
new file mode 100644
index 0000000..a285960
--- /dev/null
+++ b/skills-lock.json
@@ -0,0 +1,18 @@
+{
+ "version": 1,
+ "skills": {
+ "next-cache-components-adoption": {
+ "source": "vercel/next.js",
+ "sourceType": "github",
+ "skillPath": "skills/next-cache-components-adoption/SKILL.md",
+ "computedHash": "38eb3cb9e625b46b54493459a106ac410bc0fe59b124903d55f5090c959d292f"
+ },
+ "next-dev-loop": {
+ "source": "vercel/next.js",
+ "ref": "canary",
+ "sourceType": "github",
+ "skillPath": "skills/next-dev-loop/SKILL.md",
+ "computedHash": "c305c83b726212e0284930c65cded2c4a4ab85f9bfccfa83b62274247fe3580e"
+ }
+ }
+}