wagmi
wagmi copied to clipboard
feat: Isolate wagmi query context from react-query default context
Description
Isolating the react-query context used by wagmi from the default context used by react-query.
Additional Information
For applications that are using both the wagmi and react-query libraries, both will typically end up using the same queryClient. This means that useQuery calls from within my application may inadvertently use the wagmi client, and the defaults it sets (if the wagmiConfig provider is the innermost provider), or wagmi calls to useQuery will end up using my applications queryClient and the defaults I have set.
This actually can cause a bit of a debugging nightmare as the persister
set in the wagmi queryClient doesn't play nice with SSR frameworks like Next.js.
This lack of isolation was also discussed here: https://github.com/wagmi-dev/wagmi/discussions/661
This is my first contribution to this library so I'm not super familiar with the dev set-up. I ran the tests before and after my changes and got the same results, but I did have failing tests.
I also want to call out, I did overwrite options.context
in useBaseQuery
. I don't think this should have any negative consequences as I don't see context being passed as an option anywhere useBaseQuery
was called. If this assumption is not true please let me know, happy to change the approach.
- [x] I read the contributing docs (if this is your first contribution)
Your ENS/address: ajmay.eth
🦋 Changeset detected
Latest commit: 6565dfd956deed04f8266e6d3f0d900819e1b35e
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
Name | Type |
---|---|
wagmi | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
@aj-may is attempting to deploy a commit to the wagmi Team on Vercel.
A member of the Team first needs to authorize it.
@tmm @jxom Thoughts on this PR? Any feedback?
@jxom For some context, why is useQuery
, useBaseQuery
, etc. forked currently?
@aj-may – We needed our own useBaseQuery
as we wanted to modify the return value API of RQ without losing the tracked values behaviour.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated |
---|---|---|---|
wagmi | ✅ Ready (Inspect) | Visit Preview | Sep 25, 2022 at 8:12PM (UTC) |
If we can also get a changeset happening, that would be amazing!
pnpm changeset
, and then make this one a patch
🙏
@tmm updated based on comments. Take another look when you can
@jxom Excellent! Any final changes needed from me here, or is this just waiting on another review and merge?