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
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!
Re - any update?
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?
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
Hmm if your sidebar is in your layout it shouldn't be reloading when navigating routes that use that layout. Is that your setup?
It is
š¤
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.