Microfrontend sharing react-query QueryClientProvider throws No QueryClient set error #3697
Unanswered
scottdickerson
asked this question in
Q&A
Replies: 3 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
-
|
the same error for me |
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-queryprovider across our MFEs and running into some trouble with ouruseQuerieshooks.Our goal is to have a sharable wrapper component packaged in a common MFE that any downstream MFE can use to pickup default
QueryClientsettings. Here's an example:If we have children within our original MFE with
useQueriesthey work fine. However if consumer MFEs try and use this shared component within their MFE, theiruseQuerieshooks fail with this error:According to the debugger, the
QueryClientProviderrender code is not triggered before theuseQueryClienthook runs, which means thatcontextSharingisfalse. If I forcecontextSharingtotruewithin the debug console, the consumer MFE actually works.Is there an example repo anywhere of how the
contextSharingtrue is supposed to work for MFEs sharing a ReactQueryProvider context?Beta Was this translation helpful? Give feedback.
All reactions