How to handle multiple react-query `Providers`?

Working on a codebase that uses TRPC and a library called WAGMI that uses react-query. Since both TRPC and WAGMI provide their own QueryClientProviders I'm trying to figure out what the right way is to go about managing both of them
6 Replies
Sz
SzOP2y ago
WAGMI provides their own custom context and ensures that all of their respective useQuery and useMutation use that context
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Sz
SzOP2y ago
I've tried doing that, while TRPC does support passing in a custom QueryClient, when I try to pass in a custom QueryClient into WAGMI, I get an error that says that the queryCache types are not the same
Sz
SzOP2y ago
I did a bit more reading as well and came upon this thread on github that talks about explicitly having different contexts between packages https://github.com/TanStack/query/issues/4681
GitHub
remove contextSharing · Issue #4681 · TanStack/query
context The QueryClientProvider has a prop contextSharing: boolean. The docs say: Set this to true to enable context sharing, which will share the first and at least one instance of the context acr...
Sz
SzOP2y ago
Which leads me to think that maybe separating out the contexts may be more beneficial
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server