Skip to content

fix(website): cache examples-preview fetch so docs pages stay static - #4091

Merged
Adebesin-Cell merged 1 commit into
v6from
fix/docs-examples-caching
Sep 19, 2026
Merged

Adebesin-Cell merged 1 commit into
v6from
fix/docs-examples-caching

Conversation

@Adebesin-Cell

@Adebesin-Cell Adebesin-Cell commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

📝 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 that awaits fetchExamples(). That fetch used cache: 'no-cache', which opts the route into dynamic rendering — so those pages were server-rendered on demand (ƒ) and 500 in the Vercel runtime. Only fieldset/overview (no <ComponentPreview>) stayed static. Worked in dev and local next start, so it only showed on the deploy.

🚀 New behavior

fetchExamples uses next: { revalidate: 3600 } (cached, not dynamic) plus a 5s AbortSignal.timeout. With no dynamic opt-in, all 216 component pages prerender to static HTML under the default dynamic = 'auto' — matching how the panda docs (same fumadocs + Next stack) already work, no force-static needed.

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

  • Not framework-specific

💣 Is this a breaking change (Yes/No): No

📝 Additional information

fetchExample / fetchCodeExamples (the /examples/* route) still use no-cache; left as-is since that route serves live paid content — follow-up if those should be static too.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adebesin-Cell has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@vercel

vercel Bot commented Sep 19, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
ark-docs Ready Ready Preview Sep 19, 2026 5:32am UTC

Request Review

…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
Adebesin-Cell force-pushed the fix/docs-examples-caching branch from 46d683b to 9d60aae Compare September 19, 2026 05:28
@Adebesin-Cell
Adebesin-Cell merged commit 64bfbc7 into v6 Sep 19, 2026
6 checks passed
@Adebesin-Cell
Adebesin-Cell deleted the fix/docs-examples-caching branch September 19, 2026 16:07
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