@@ -3,14 +3,52 @@ import {
33 redirect ,
44 notFound ,
55 createFileRoute ,
6+ lazyRouteComponent ,
67} from '@tanstack/react-router'
8+ import type { AsyncRouteComponent } from '@tanstack/react-router'
79import { RedirectVersionBanner } from '~/components/RedirectVersionBanner'
810import { findLibrary , getBranch } from '~/libraries'
11+ import type { LibraryId } from '~/libraries'
912import { getTanstackDocsConfig } from '~/utils/config'
1013
14+ export const landingComponents : Partial <
15+ Record < LibraryId , AsyncRouteComponent < object > >
16+ > = {
17+ query : lazyRouteComponent ( ( ) => import ( '~/components/landing/QueryLanding' ) ) ,
18+ router : lazyRouteComponent (
19+ ( ) => import ( '~/components/landing/RouterLanding' ) ,
20+ ) ,
21+ table : lazyRouteComponent ( ( ) => import ( '~/components/landing/TableLanding' ) ) ,
22+ form : lazyRouteComponent ( ( ) => import ( '~/components/landing/FormLanding' ) ) ,
23+ start : lazyRouteComponent ( ( ) => import ( '~/components/landing/StartLanding' ) ) ,
24+ store : lazyRouteComponent ( ( ) => import ( '~/components/landing/StoreLanding' ) ) ,
25+ virtual : lazyRouteComponent (
26+ ( ) => import ( '~/components/landing/VirtualLanding' ) ,
27+ ) ,
28+ ranger : lazyRouteComponent (
29+ ( ) => import ( '~/components/landing/RangerLanding' ) ,
30+ ) ,
31+ pacer : lazyRouteComponent ( ( ) => import ( '~/components/landing/PacerLanding' ) ) ,
32+ hotkeys : lazyRouteComponent (
33+ ( ) => import ( '~/components/landing/HotkeysLanding' ) ,
34+ ) ,
35+ config : lazyRouteComponent (
36+ ( ) => import ( '~/components/landing/ConfigLanding' ) ,
37+ ) ,
38+ db : lazyRouteComponent ( ( ) => import ( '~/components/landing/DbLanding' ) ) ,
39+ ai : lazyRouteComponent ( ( ) => import ( '~/components/landing/AiLanding' ) ) ,
40+ devtools : lazyRouteComponent (
41+ ( ) => import ( '~/components/landing/DevtoolsLanding' ) ,
42+ ) ,
43+ cli : lazyRouteComponent ( ( ) => import ( '~/components/landing/CliLanding' ) ) ,
44+ intent : lazyRouteComponent (
45+ ( ) => import ( '~/components/landing/IntentLanding' ) ,
46+ ) ,
47+ }
48+
1149export const Route = createFileRoute ( '/$libraryId/$version' ) ( {
1250 staleTime : 1000 * 60 * 5 ,
13- beforeLoad : ( ctx ) => {
51+ beforeLoad : async ( ctx ) => {
1452 const { libraryId, version } = ctx . params
1553 const library = findLibrary ( libraryId )
1654
@@ -25,6 +63,8 @@ export const Route = createFileRoute('/$libraryId/$version')({
2563 params : { libraryId, version : 'latest' } as never ,
2664 } )
2765 }
66+
67+ await landingComponents [ libraryId as LibraryId ] ?. preload ?.( )
2868 } ,
2969 loader : async ( ctx ) => {
3070 const { libraryId, version } = ctx . params
0 commit comments