Repository navigation
Replies: 2 comments 3 replies
|
this needs more context. i assume you are using TanStack Start, not just Router. Are you using |
|
Assuming this is TanStack Start, const modules = import.meta.glob('/src/content/*.mdx')
export const Route = createFileRoute('/posts/$slug')({
ssr: false,
loader: async ({ params }) => {
const load = modules[`/src/content/${params.slug}.mdx`]
if (!load) throw notFound()
return load()
},
})With The unavoidable difference is the initial request: Start must render a pending fallback until hydration for an |
Uh oh!
There was an error while loading. Please reload this page.
Currently, loader needs to return serializable data. However, there are always a need to load data that is not serializable and that can result in a serialisation error.
For example:
In this case, the import is not able to be sent from server to client during SSG. It can load within 1 second and should be ready when the navigation happens.
But if the import is initiated at the client side and handled with
<Await>, a fallback will still be shown and flashed pretty quickly.I tried all kinds of ways to make it work so that the navigation will happen when Content is loaded, but none of the ways will allow this behaviour.
This makes me feel that a react-router equivalent of
clientLoaderis helpful in this context.All reactions