fix(website): cache examples-preview fetch so docs pages stay static - #4091
Merged
Merged
Conversation
There was a problem hiding this comment.
Adebesin-Cell has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
5 tasks
…es stay static Move the Ark Plus examples fetch off cache: 'no-cache' (which opted every component page into dynamic rendering) to a revalidated fetch with a 5s AbortSignal timeout, so the pages prerender statically and the build never hangs when the Plus API (or npm registry, for the version dropdown) is slow or unreachable — it falls back gracefully.
Adebesin-Cell
force-pushed
the
fix/docs-examples-caching
branch
from
September 19, 2026 05:28
46d683b to
9d60aae
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.
📝 Description
Fixes the docs site 500ing on component pages, and the follow-on build hang. Root cause: an uncached fetch opting every component page into dynamic rendering.
⛳️ Current behavior
<ComponentPreview>(52 of 54 component pages) renders<ExamplesPreview>, an async server component thatawaitsfetchExamples(). That fetch usedcache: 'no-cache', which opts the route into dynamic rendering — so those pages were server-rendered on demand (ƒ) and 500 in the Vercel runtime. Onlyfieldset/overview(no<ComponentPreview>) stayed static. Worked in dev and localnext start, so it only showed on the deploy.🚀 New behavior
fetchExamplesusesnext: { revalidate: 3600 }(cached, not dynamic) plus a 5sAbortSignal.timeout. With no dynamic opt-in, all 216 component pages prerender to static HTML under the defaultdynamic = 'auto'— matching how the panda docs (same fumadocs + Next stack) already work, noforce-staticneeded.The timeout matters: caching moves the Plus-API fetch to build time, and the Plus API isn't always reachable from the build (the first attempt at this without a timeout hung the build with 60s per-page timeouts). With the timeout, an unreachable/slow Plus API (or npm registry, for the version dropdown — same treatment applied) aborts fast and falls back via the existing
.catch(() => []), so the build always completes; pages just render without the examples grid when the API is unavailable.Verified locally (no network): build completes, 0 timeouts, all 216 component pages prerendered as static HTML.
🧩 Frameworks
💣 Is this a breaking change (Yes/No): No
📝 Additional information
fetchExample/fetchCodeExamples(the/examples/*route) still useno-cache; left as-is since that route serves live paid content — follow-up if those should be static too.