Nex
Nex•3mo ago

Caching Auth States

I am using tanstack query in my app. Are there guides on implementing caching for authentication w/ tanstack-query and convex? Also, convex exports Authenticated, Unauthenticated, AuthLoading components, these are quite useful - but they all use useConvexAuth() under the hood. As far as I could figure out, useConvexAuth() doesn't use any caching.
7 Replies
Convex Bot
Convex Bot•3mo ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
Nex
NexOP•3mo ago
Re - any update?
erquhart
erquhart•2mo ago
Caching authentication is a tricky thing. Can you say more about the outcome you're going for or the problem you want to solve in your UX? Delayed initial load maybe?
Nex
NexOP•2mo ago
I have a sidebar that loads in auth state, then list of searches for a user. I want to give my app a more "spa" feel such that the sidebar doesn't have to load on every page change
erquhart
erquhart•2mo ago
Hmm if your sidebar is in your layout it shouldn't be reloading when navigating routes that use that layout. Is that your setup?
Nex
NexOP•2mo ago
It is šŸ¤”
erquhart
erquhart•2mo ago
I'd dig into the TanStack side of this if I were you, that shouldn't be happening. I'm personally only spending so much time troubleshooting tanstack issues because it's still very much a moving target.

Did you find this page helpful?