Is it possible to globally configure a base queryKey
?
#8579
-
In my application, users can log in under different "companies," with each company having its own data for the same API endpoints. The issue happens when a user logs in with Company A and then switches to Company B. For a few seconds, the data from Company A is displayed while the application revalidates and fetches the data for Company B. To resolve this, I plan to include the company ID in all I can manually add the company ID to each // This doesn't work, it's just an example of what i mean
const queryClient = new QueryClient({
defaultOptions: {
queries: {
baseQueryKey: companyId,
},
},
}) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Recently the possibility to register global query and mutation types was added, which is a nice solution for this. A type error will then occur if a key doesn't start with one of the allowed prefixes. |
Beta Was this translation helpful? Give feedback.
Recently the possibility to register global query and mutation types was added, which is a nice solution for this. A type error will then occur if a key doesn't start with one of the allowed prefixes.
TypeScript playground