Clerk shared user state

I'm using the t3-turbo-and-clerk template and as I see, TRPC initializes the context with clerk's getAuth method so that the auth info can be access from the procedures. getAuth makes it possible to create a TRPC middleware so that the (whole) user returned from the db (relation with clerk's userId) can be accessed in the context. but what are the best practises to get the full user (from the db, not just from clerk) in the frontend? does clerk provide a simple way for that? if not, what is the best way to have the user also on the client side? I'm thinking about something just like the useUser hook from clerk but with my custom data
3 Replies
Neto
Neto2y ago
you can make a query that get the authenticated user (from clerk), and enrich with more info (from db)
SGeri
SGeri2y ago
would you refetch the user every time the user navigates to a different route?
Neto
Neto2y ago
you can create a hook wrapper and disable refetch
Want results from more Discord servers?
Add your server