Skip to content

fix(docs): render all code example languages at build time - #192

Merged
justin-schroeder merged 1 commit into
release/0.6.0from
fix/docs-code-tabs
Jun 11, 2026
Merged

justin-schroeder merged 1 commit into
release/0.6.0from
fix/docs-code-tabs

Conversation

@justin-schroeder

Copy link
Copy Markdown
Member

Fixes #174 (only the React tab renders on drag-and-drop.formkit.com).

Root cause — two layers

  1. The Vue/Solid/Native/Marko panes are server components mounted lazily (v-if on first tab click). On the statically deployed site, that mount issues a runtime /__nuxt_island/... request with no server to answer it → empty pane.
  2. Eagerly prerendering them surfaced a second bug the lazy islands had been hiding: docs/examples/config/config.ts mirrors ParentConfig and still used the unparameterized handler types — after fix(types): parameterize event handler types with the config generic #186 that's TS2314, twoslash rejects the sample, and the Native island 500s even with a server. This is consistent with the issue reporting all non-React tabs blank.

Fix

  • All five panes render during SSG and toggle with v-show. The highlighted HTML ships in the static page; the client-perf win of server components (no shiki/twoslash on the client) is preserved — the cost moves to build time.
  • config.ts example updated to SortEvent<T> et al.

Verification

  • nuxt generate completes with zero prerender errors (71 island routes), where it previously failed.
  • Generated index.html contains the raw-code containers and shiki output for all five languages (774 highlighted blocks).
  • Copy button now works for every tab immediately (raw-code containers all present at load).

The non-React language panes are Nuxt server components mounted lazily
on tab click. On the statically deployed site there is no server to
answer the runtime island request, so the Vue/Solid/Native/Marko tabs
rendered empty (#174). All panes now render during prerender and toggle
with v-show — the highlighted HTML ships in the static page, so the
client-perf benefit of server components is preserved.

Prerendering all panes also surfaced a build-breaking error the lazy
islands had been hiding: docs/examples/config/config.ts mirrors
ParentConfig and still used the unparameterized event handler types
(TS2314 after the #186 fix) — twoslash rejected the sample and the
island 500'd. Updated to SortEvent<T> et al.

Verified: nuxt generate succeeds (71 island routes prerendered, zero
errors) and the generated index.html contains raw-code containers for
all five languages.

Fixes #174.
@vercel

vercel Bot commented Jun 11, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
drag-and-drop-docs Ready Ready Preview Jun 11, 2026 5:27pm

Request Review

@justin-schroeder justin-schroeder left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Review notes: payload size is the main tradeoff — five static panes per example instead of one. That's inert HTML (no extra JS), and it's what made the build catch the broken Native sample, which I consider the stronger argument: lazy islands turned doc-sample type errors into invisible runtime 500s. The loadedLangs machinery and its watch hook are gone; collectRawCode's retry loop is kept (it still guards slow hydration) but now finds every container on the first pass.

@justin-schroeder
justin-schroeder merged commit ecf661a into release/0.6.0 Jun 11, 2026
0 of 2 checks passed

This branch was successfully deployed

1 active deployment
Preview — 1f0f6056 Deployed Jun 11, 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