T
TanStack17mo ago
eastern-cyan

TanStack Query if I need session in call?

I am using NextJS app router. I thought I could use TanStack Query following the Advanced SSR guide, however it seems that if I need the session, I cant have useQuery or queryClient.prefetchQuery() call my function because if its server side, I won't have access. Any ideas? Using Next Auth, getServerSession, or useSession.
3 Replies
robust-apricot
robust-apricot17mo ago
lol i think i asked this Q recently prefetchQuery doesnt give u the data but if u need it
robust-apricot
robust-apricot17mo ago
QueryClient | TanStack Query Docs
QueryClient The QueryClient can be used to interact with a cache:
robust-apricot
robust-apricot17mo ago
fetchQuery fetch, store in cache and get the data u can then pass it around as props

Did you find this page helpful?