Skip to content

Code split library landing routes#970

Merged
tannerlinsley merged 1 commit into
mainfrom
taren/code-split-landing-routes
Jun 8, 2026
Merged

Code split library landing routes#970
tannerlinsley merged 1 commit into
mainfrom
taren/code-split-landing-routes

Conversation

@tannerlinsley

@tannerlinsley tannerlinsley commented Jun 8, 2026

Copy link
Copy Markdown
Member

What changed

  • Added concrete landing routes for each library, so each landing page imports only its own landing component.
  • Moved shared landing route behavior into a route-only helper and kept the existing library version helper lightweight for docs routes.
  • Left the dynamic landing fallback as a redirect into the new static route IDs.
  • Regenerated the TanStack Router route tree and moved landing prop types off the dynamic route module.

Why

The previous dynamic landing route imported every landing component up front. With real per-library routes, TanStack Router's built-in route code splitting can split those landing chunks normally.

Validation

  • pnpm test
  • Commit hook ran pnpm run format && pnpm run test

Lint still reports the existing warnings in admin/shop files, but exits successfully.

Summary by CodeRabbit

  • Refactor
    • Reorganized landing page routing infrastructure by consolidating shared logic and creating library-specific versioned route handlers for improved maintainability.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR refactors library landing pages from a single dynamic parameterized route (/$libraryId/$version/) to 14 static library-specific versioned routes (/ai/$version/, /cli/$version/, etc.). It extracts shared landing infrastructure into reusable modules, converts the old dynamic route to a redirect-only gateway, and updates all landing components to use the new type sources.

Changes

Library Landing Page Static Routing Refactor

Layer / File(s) Summary
Type contract and shared landing infrastructure
src/routes/-library-landing.tsx, src/routes/-library-landing-route.tsx
Adds LandingLibraryId union type enumerating supported library IDs and a comprehensive landing route module exporting libraryLandingStaleTime, beforeLoadLibraryLanding (version validation/redirect), loadLibraryLandingRouteData (concurrent config and RSC loading), getLibraryLandingHead (SEO with visibility-based noindex), getLibraryLandingHeaders (conditional StackBlitz headers), LibraryLandingLayout (DocsLayout wrapper with version/theme), and LibraryNavbarTitle (gradient-styled title link).
Dynamic parameterized route refactored to redirects
src/routes/$libraryId/$version.index.tsx
Removes data-driven rendering (loader, head, headers, staticData, component) and replaces with a lightweight beforeLoad hook that validates library existence, checks version validity, and redirects to static library-specific landing routes via redirectToStaticLanding.
Landing component import source updates
src/components/landing/*Landing.tsx (14 files)
All landing components (AI, CLI, Config, DB, Devtools, Form, Hotkeys, Intent, Pacer, Query, Ranger, Store, Table, Virtual, Workflow) update LandingComponentProps import from ~/routes/$libraryId/$version to ~/routes/-library-landing.
Library-specific versioned routes
src/routes/ai.$version.index.tsx, src/routes/cli.$version.index.tsx, src/routes/config.$version.index.tsx, src/routes/db.$version.index.tsx, src/routes/devtools.$version.index.tsx, src/routes/form.$version.index.tsx, src/routes/hotkeys.$version.index.tsx, src/routes/intent.$version.index.tsx, src/routes/pacer.$version.index.tsx, src/routes/query.$version.index.tsx, src/routes/ranger.$version.index.tsx, src/routes/router.$version.index.tsx, src/routes/start.$version.index.tsx, src/routes/store.$version.index.tsx, src/routes/table.$version.index.tsx, src/routes/virtual.$version.index.tsx, src/routes/workflow.$version.index.tsx (17 files total)
Each new route wires shared landing infrastructure (staleTime, beforeLoad, loader, head, headers, staticData.Title) and renders the corresponding landing component inside LibraryLandingLayout, passing through loader-resolved config and landingCodeExampleRsc, with navbar title derived from version route param via LibraryNavbarTitle.
Generated route tree registry
src/routeTree.gen.ts
Updates FileRoutesByFullPath, FileRoutesByTo, FileRoutesById, and FileRouteTypes to register all 14 new library-specific versioned routes and associated index paths. Extends RootRouteChildren interface and rootRouteChildren constant to wire the new route constants. Removes trailing @tanstack/react-start module augmentation block.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • KevinVandy

Poem

🐰 Hop, hop! The landing pages now fly free,
Each library gets its own route you see,
From one dynamic path to static refrain,
Shared logic flows through the domain,
No more param juggling—just clean, neat display!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Code split library landing routes' clearly and concisely describes the main objective of the PR: implementing code splitting for library landing routes by creating per-library route files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch taren/code-split-landing-routes

Comment @coderabbitai help to get the list of available commands and usage tips.

@tannerlinsley tannerlinsley marked this pull request as ready for review June 8, 2026 21:47
@tannerlinsley tannerlinsley merged commit 29239fb into main Jun 8, 2026
8 of 9 checks passed
@tannerlinsley tannerlinsley deleted the taren/code-split-landing-routes branch June 8, 2026 21:56
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