Open History to see the last commit
1import { hydrate } from '@tanstack/router-core/ssr/client'
2import { Await } from '../awaited'
3import { HeadContent } from '../HeadContent'
4import { RouterProvider } from '../RouterProvider'
5import type { AnyRouter } from '@tanstack/router-core'
6import type { JSXElement } from 'solid-js'
7β
8let hydrationPromise: Promise<void> | undefined
9β
10const Dummy = (props: { children?: JSXElement }) => <>{props.children}</>
11β
12export function RouterClient(props: { router: AnyRouter }) {
13 hydrationPromise ??= hydrate(props.router).finally(() => window.$_TSR!.h())
14β
15 return (
16 <Await
17 promise={hydrationPromise.then(() => true)}
18 children={() => (
19 <Dummy>
20 <Dummy>
21 <RouterProvider
22 router={props.router}
23 InnerWrap={(props) => (
24 <Dummy>
25 <Dummy>
26 <HeadContent />
27 {props.children}
28 </Dummy>
29 <Dummy />
30 </Dummy>
31 )}
32 />
33 </Dummy>
34 </Dummy>
35 )}
36 />
37 )
38}