Enable Cache Components - #25
Merged
Merged
Conversation
Turn on `cacheComponents: true` and make every route prerenderable
(Direct adoption — no `instant = false` opt-outs).
Prerequisite config removal (these error under the flag; this canary also
rejects `dynamicParams`):
- Drop `dynamic`/`revalidate`/`dynamicParams` from the docs page, view page,
examples layout, and the og/llms route handlers. Unknown params still 404
via the existing in-handler `notFound()` checks.
Make data access prerenderable:
- Route handlers (`index.md`, `llms*.txt`, `llms.mdx/*`) cache their generated
text with `"use cache"` + `cacheLife("max")`, keyed by serializable slugs.
- `getRegistryItem` is cached with `"use cache"` (registry source is static).
Defer request-time / unstable reads behind Suspense so the shells prerender:
- Live component previews call `today()` (`Date.now()`); wrap `<Component/>` in
Suspense at each embed site (component-preview, view page, theme Blocks).
- fumadocs `ServerCodeBlock` reads `Date.now()` during client-component SSR,
which can't be cached; `ComponentCode` uses `await connection()` + Suspense to
render registry code blocks at request time.
`next build` is green; docs/view pages are Partial Prerender (◐), text routes
are static, og/search/llms.mdx are dynamic (ƒ).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Enables
cacheComponents: trueinapps/preskokand makes every route prerenderable. Direct adoption — noinstant = falseopt-outs anywhere.next buildis green: all 266 pages generate. Verified at runtime againstnext start(not just the build).Changes
Removed configs that error under the flag (this canary,
16.3.0-canary.66, also rejectsdynamicParams, not justdynamic/revalidate/fetchCache):notFound()checks.Cached static data access (
"use cache"+cacheLife("max")):index.md,llms.txt,llms-full.txt,llms.mdx/*cache their generated text, keyed by serializable slugs.getRegistryItem(registry source is static).Deferred request-time / unstable reads behind
<Suspense>so shells prerender:today()(Date.now()) → wrapped<Component/>in Suspense at each embed site (component-preview,view/[name], theme<Blocks/>).ServerCodeBlockreadsDate.now()during client-component SSR (can't be cached) →ComponentCodeusesawait connection()+ Suspense to render registry code blocks at request time.Resulting route types
◐Partial Prerender: docs pages, most/view/*(static shell + streamed code/previews)○Static:/theme,/components,/examples/authentication,/llms.txt,/index.md,/llms-full.txtƒDynamic:/api/search,/og,/og/docs/*,/llms.mdx/*(genuinely request-time)Reviewer notes / trade-offs
Date.now()during highlight SSR. Worth a fumadocs issue if we want them static again.revalidate = false→cacheLife("max")surfaces asRevalidate 30d / Expire 1y(was "never"). Negligible for deploy-rebuilt content./og/docs/*and/llms.mdx/*are nowƒrather than prebuilt-static; both verified working.next devover-reports these as blocking-prerender errors even whereconnection()makes the subtree legitimately dynamic — trustnext build.🤖 Generated with Claude Code