T
TanStack2mo ago
xenial-black

how to integrate tanstack db with tanstack start in spa mode?

The problem i am facing is when using createCollection with queryCollectionOptions, i dont know where to get the queryClient.
6 Replies
like-gold
like-gold2mo ago
if you already have one, use that. If not, create one from query-core
xenial-black
xenial-blackOP2mo ago
The generated project creates a query client instance in the getRouter function and adds it to the context. So i dont know should i somehow use that one or just create a new instance somewhere else and use it? In that case, i have 2 query client instances. I have a feeling this is a wrong way to do it.
like-gold
like-gold2mo ago
Either works. It's less confusing to just have one
xenial-black
xenial-blackOP2mo ago
Thanks. Having one is easier to reason about but do you know how to access the one created in getRouter?
like-gold
like-gold2mo ago
no
xenial-black
xenial-blackOP2mo ago
I will look at the docs again. Thanks so much for taking time to answer me.

Did you find this page helpful?