multiple users and multiple workspaces per user
My application supports multiple users to be logged in on the same browser and multiple workspaces per user (like Notion, Linear, etc.). Since you can switch between users and workspaces in the same tab -
Q1 - should each of my query keys have the sessionId (or email) and workspaceId as part of it? If so, is there an example repo that has an implementation?
Q2 - My guess is I need a useQuery wrapper that adds the sessionId and workspaceId to every query key?
2 Replies
absent-sapphire•9mo ago
queryHashFn should suffice for Q2
For Q1, I'd probably use a queryClient for each user but I've never needed that before so I'm not sure how I'd go about thatprobable-pink•9mo ago
you can also just clear the cache if the user switches between workspaces (if that's good enough)