Michal Srb
Michal Srb2y ago

Is there any way to invalidate the local cache or manually refetch useQuery?

Question from @Mikael Lirbank
4 Replies
Mikael Lirbank
I guess I should make the args reactive (state) and just update the input args to refresh?
Michal Srb
Michal SrbOP2y ago
useQuery is already reactive. I'm curious in which scenario you're not getting updated values?
Mikael Lirbank
I send a cookie via args and when the user sign out I need to refresh the current user query so the UI updates. Eg getViewer returns the current user if the cookie is correct, and null if there is no cookie (or the cookie is invalid). Cookie = sessiontToken. It's all good, I am adding a custom Contex+Provider to solve it.
Michal Srb
Michal SrbOP2y ago
Yup, that's the way to go! Sounds very similar to our Lucia template: https://stack.convex.dev/convex-with-lucia
Custom Authentication (with Lucia)
Learn how to build a full stack app with authentication without any third-party auth providers, using Convex and the Lucia library.

Did you find this page helpful?