-
I’m exploring if it makes sense to use data loaded by TanStack Router’s loaders to initially hydrate TanStack DB collections. Since loaders run on both server and client (for initial load and navigations), can loader data be effectively used to jump-start collections without conflict? Or are loaders and collections two separate data-fetching layers that don’t integrate well (for now)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Yup, this makes total sense and is something we'll be illustrating in the docs and examples. You can see some existing discussions here: https://github.com/search?q=repo%3ATanStack%2Fdb+preload&type=issues End goal is something like: const query = createCollection(liveQueryOptions(...))
export default createFileRoute({
loader: () => query.preload()
})
function Component () {
const { data } = useLiveQuery(query)
} |
Beta Was this translation helpful? Give feedback.
Yup, this makes total sense and is something we'll be illustrating in the docs and examples.
You can see some existing discussions here: https://github.com/search?q=repo%3ATanStack%2Fdb+preload&type=issues
End goal is something like: