-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
remove contextSharing #4681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I removed Just checking if I should commit to it :D |
Fair enough, my bad ;) |
@Moshyfawn It looks like we both created PRs for this almost at the exact same time 😆. I guess it's my fault for not saying I will work on this beforehand (I didn't expect to actually finish it, I was just looking into the TanStack Query code base). It looks like you only implemented the changes for the react-query implementation. I have removed it from react, solid and vue and updated the tests + documentation where required. If you have any additions / changes you think I should add to my PR I'd be happy to work with you on anything. |
Ahaha, what are the chances :D I've closed my PR in favour of yours as you've done most of the job already. I left a couple of suggestions on yours; please, let me know what you think ;) |
Hi, I am not sure if I can explain the use case clearly, but I will try here Please reconsider this deprecation for the use case or suggest an alternative workaround without it thanks |
in v5, where context sharing is removed, we allow to pass a Just my personal opinion: micro-frontends are supposed to be fully isolated applications. Having a shared query cache seems like it would violate that principle. You'd need to make sure that those isolated micro-frontends wouldn't write to the same location in the cache, which means they'd need to know about each other ... |
@TkDodo Do we have any plan to use react-query without having wrapping QueryClientProvider. Like the way in v5, we can pass
Expecting something like that but without QueryClientProvider |
@vctqs1 if you pass a |
Wow, that is exactly what I'm looking for. Very glad to hear that. Thank you |
context
The
QueryClientProvider
has a propcontextSharing: boolean
. The docs say:To be honest - I don't really know how this property is working. There were some discussion on this issue that suggest that it is not really useful.
For microfrontends, isolation is often preferred. With v4, we introduced the option to pass a custom context, which allows for exactly that.
If you want your app to use the same client when it's composed of multiple packages, all you'd need to do is create one QueryClient in your app and let the different bundles pick those up. As long as they all use the same version of TanStack Query, this should work fine.
proposal
contextSharing
in v4contextSharing
fromQueryClientProvider
in v5The text was updated successfully, but these errors were encountered: