Microfrontend sharing react-query QueryClientProvider throws No QueryClient set error #3697
Unanswered
scottdickerson
asked this question in
Q&A
Replies: 2 comments 2 replies
-
I was able to fix this by forcing both MFEs to use the same version of
|
Beta Was this translation helpful? Give feedback.
2 replies
-
I have this shared repo to reprodce |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We're trying to share a common
react-query
provider across our MFEs and running into some trouble with ouruseQueries
hooks.Our goal is to have a sharable wrapper component packaged in a common MFE that any downstream MFE can use to pickup default
QueryClient
settings. Here's an example:If we have children within our original MFE with
useQueries
they work fine. However if consumer MFEs try and use this shared component within their MFE, theiruseQueries
hooks fail with this error:According to the debugger, the
QueryClientProvider
render code is not triggered before theuseQueryClient
hook runs, which means thatcontextSharing
isfalse
. If I forcecontextSharing
totrue
within the debug console, the consumer MFE actually works.Is there an example repo anywhere of how the
contextSharing
true is supposed to work for MFEs sharing a ReactQueryProvider context?Beta Was this translation helpful? Give feedback.
All reactions