Skip to content

docs(ui): replace 49 hand-rolled docs.*.tsx thin routes with one dynamic docs.$slug.tsx route#8181

Closed
JSONbored wants to merge 1 commit into
mainfrom
docs-ui/collapse-per-page-routes-into-dynamic-slug
Closed

docs(ui): replace 49 hand-rolled docs.*.tsx thin routes with one dynamic docs.$slug.tsx route#8181
JSONbored wants to merge 1 commit into
mainfrom
docs-ui/collapse-per-page-routes-into-dynamic-slug

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Every docs page carried an identical hand-rolled TanStack route file: a loader calling getDocPage, head/og meta duplicating the .mdx frontmatter's own title/description, and the same DocsPage + Suspense/LoadingState body. Adding a page meant touching 5+ files and regenerating the route tree; two tests pinned the route-file count and had to be bumped on every addition.

  • One dynamic docs.$slug.tsx route replaces all 49 per-page files. title/description come from frontmatter (already did); eyebrow (the one real per-page datum, previously a hand-copied JSX prop) moves into frontmatter too, via a new required field in source.config.ts's page schema.
  • docs.index.tsx (a real static page) and docs.fumadocs-spike-api-reference.tsx (a standalone Scalar widget, not DocsPage/MDX at all) stay as their own routes -- audited, neither is boilerplate this replaces.
  • Every literal to="/docs/<slug>" Link across the app (nav sidebar, footer, header dropdown, home page, install flow, agents/miners/maintainers pages) now uses the typed to="/docs/$slug" params={{ slug }} form instead -- done properly with real params, not a type-erasing cast, including fixing two pre-existing as "/docs" casts in docs-nav.tsx/docs.index.tsx found along the way.
  • docs.miner-coding-agent.tsx's three exported data arrays (asserted against by a test, unrelated to routing) moved to src/lib/miner-coding-agent-docs-data.ts; their test moved alongside them.
  • The two route-file-count-pinning tests (docs-source-server-isolation, docs-routes-loading-state) now assert the single dynamic route's shape instead of a per-page count.
  • Three test-only Link mocks (docs.ams-observability-callout, install, install.permissions) updated to interpolate $-params the same way the real router resolves them, so their href assertions stay faithful.

Closes #8151.

Test plan

  • npm run --workspace apps/loopover-ui typecheck -- clean, zero errors (25 real type errors from the route collapse fixed with proper params, not casts).
  • npm run --workspace apps/loopover-ui lint -- 0 errors (pre-existing repo-wide react-refresh/only-export-components warnings on route files, unrelated to this change).
  • Full apps/loopover-ui test suite: 509/509 passing across 81 files.
  • npm run docs:drift-check -- clean.
  • npm run --workspace apps/loopover-ui build -- production build succeeds.
  • Verified live in the browser: a real docs page (/docs/quickstart) renders correct title/eyebrow/description/MDX content; sidebar nav renders and highlights the active page; client-side navigation between docs pages works; a nonexistent slug renders a real 404 with a "Go home" link; the docs index (/docs) and the untouched Scalar API reference route (/docs/fumadocs-spike-api-reference) both still work.
  • Touched paths are under apps/**, outside coverage.include, so Codecov does not gate this patch (per the issue's own Test Coverage Requirements note).

…mic docs.$slug.tsx route

Every docs page carried an identical hand-rolled TanStack route file: a loader
calling getDocPage, head/og meta duplicating the .mdx frontmatter's own
title/description, and the same DocsPage + Suspense/LoadingState body. Adding
a page meant touching 5+ files and regenerating the route tree; two tests
pinned the route-file count and had to be bumped on every addition.

- One dynamic docs.$slug.tsx route replaces all 49 per-page files. title/
  description come from frontmatter (already did); eyebrow (the one real
  per-page datum, previously a hand-copied JSX prop) moves into frontmatter
  too, via a new required field in source.config.ts's page schema.
- docs.index.tsx (a real static page) and docs.fumadocs-spike-api-reference.tsx
  (a standalone Scalar widget, not DocsPage/MDX at all) stay as their own
  routes -- audited, neither is boilerplate this replaces.
- Every literal `to="/docs/<slug>"` Link across the app (nav sidebar, footer,
  header dropdown, home page, install flow, agents/miners/maintainers pages)
  now uses the typed `to="/docs/$slug" params={{ slug }}` form instead --
  done properly with real params, not a type-erasing cast, including fixing
  two pre-existing `as "/docs"` casts in docs-nav.tsx/docs.index.tsx found
  along the way.
- docs.miner-coding-agent.tsx's three exported data arrays (asserted against
  by a test, unrelated to routing) moved to
  src/lib/miner-coding-agent-docs-data.ts; their test moved alongside them.
- The two route-file-count-pinning tests (docs-source-server-isolation,
  docs-routes-loading-state) now assert the single dynamic route's shape
  instead of a per-page count.
- Three test-only `Link` mocks (docs.ams-observability-callout,
  install, install.permissions) updated to interpolate $-params the same
  way the real router resolves them, so their href assertions stay faithful.

Verified in the browser: real docs pages render correctly (title/eyebrow/
description/MDX content), sidebar nav renders + highlights the active page,
client-side navigation works, a nonexistent slug renders a real 404, the
docs index and the untouched Scalar API route both still work.

Closes #8151.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
loopover-ui 32e8b17 Commit Preview URL

Branch Preview URL
Jul 23 2026, 09:08 AM

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored

Copy link
Copy Markdown
Owner Author

Closing and reopening to force a fresh CI run against the latest commit (fixed a pre-existing whitespace issue in self-hosting-security.mdx that failed the first run's git diff --check) -- same GitHub API propagation lag seen earlier tonight on #8165/#8168.

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.

docs(ui): replace the 49 hand-rolled docs.*.tsx thin routes with one dynamic docs.$slug.tsx route

1 participant