Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Canceled after 0s
23 lines
659 B
Plaintext
23 lines
659 B
Plaintext
import { hydrate } from '@tanstack/router-core/ssr/client'
|
|
import { Await } from '../awaited'
|
|
import { RouterProvider } from '../RouterProvider'
|
|
import type { AnyRouter } from '@tanstack/router-core'
|
|
|
|
let hydrationPromise: Promise<void | Array<Array<void>>> | undefined
|
|
|
|
export function RouterClient(props: { router: AnyRouter }) {
|
|
if (!hydrationPromise) {
|
|
if (!props.router.stores.matchesId.get().length) {
|
|
hydrationPromise = hydrate(props.router)
|
|
} else {
|
|
hydrationPromise = Promise.resolve()
|
|
}
|
|
}
|
|
return (
|
|
<Await
|
|
promise={hydrationPromise}
|
|
children={() => <RouterProvider router={props.router} />}
|
|
/>
|
|
)
|
|
}
|