Skip to content

fix(docs): use router Link for landing nav to avoid full-page reload#16

Merged
rqbazan merged 1 commit into
mainfrom
fix/docsite-landing-spa-nav
May 21, 2026
Merged

fix(docs): use router Link for landing nav to avoid full-page reload#16
rqbazan merged 1 commit into
mainfrom
fix/docsite-landing-spa-nav

Conversation

@rqbazan
Copy link
Copy Markdown
Member

@rqbazan rqbazan commented May 21, 2026

Summary

  • Landing nav links to /docs were plain <a> tags, causing a full document navigation on click — visible as a flash on production.
  • Production also issues a 307 /docs → /docs/ (Cloudflare Assets canonicalizing the URL against dist/client/docs/index.html), adding a round-trip on top of the full reload and triggering a cascade of 304 revalidations for assets the browser already had cached.
  • Switch internal landing links (nav desktop, nav mobile, hero CTA, close CTA) to TanStack Router <Link> so the transition is 100% client-side. With defaultPreload: "intent" already set in router.tsx, the splat loader is prefetched on hover.
  • Bump internal hrefs to /docs/ with trailing slash so direct loads / crawlers / shared links also skip the 307.

External links (Changelog → GitHub releases) stay as <a target="_blank">.

Test plan

  • pnpm --filter docsite tsc --noEmit passes (also via lefthook pre-commit)
  • pnpm --filter docsite build completes — prerender unchanged
  • pnpm --filter docsite preview → click each landing link (Docs, API, Guides, hero "Read the docs", close "Read the docs") → no flash, URL bar shows trailing-slash variant, no 307 in Network tab
  • Mobile menu (≤480px): same checks, plus menu closes after click

🤖 Generated with Claude Code

Landing links to /docs were plain <a> tags, forcing a full document
navigation on click. In production this also incurred a 307 redirect
from Cloudflare Assets canonicalizing /docs to /docs/, making the
flash visible. Switch internal links to TanStack Router <Link> so the
transition stays client-side, and add the trailing slash so direct
loads skip the 307 as well.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vland-bot
Copy link
Copy Markdown
Contributor

vland-bot Bot commented May 21, 2026

Preview release

Latest commit: f8c9d28

No packages have been released.

@rqbazan rqbazan merged commit 70cac88 into main May 21, 2026
4 checks passed
@rqbazan rqbazan deleted the fix/docsite-landing-spa-nav branch May 21, 2026 00:38
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