-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Update useReadContract Example To Show Tanstack Params #3617
Comments
Seems like the thing that trips folks up (or at least what we see a lot) is setting |
Despite docs mentioning tanStack react-query on getting started / wagmi provider docs, I've seen a lot of people still not understanding that all hooks are wrapped with react-query and response fields mimic that of react query as well as that |
Yeah down for linking to it somewhere. Also, not all hooks use TanStack Query, e.g. |
Definitely open to having anything mentioned or emphasized, to get devs just use the idea that they can control hooks/requests better. |
We mention TanStack Query in a bunch of places already and it's the first guide in the guides section so closing this for now. Feel free to open a PR with something more actionable. Incomplete list of places it's mentioned: |
This issue has been locked since it has been closed for more than 14 days. If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest wagmi version. If you have any other comments you can create a new discussion. |
What is the type of issue?
Something else
What is the issue?
Context
This may be opinionated, but I believe that this will help new devs understand tanstack a bit better, and avoid multiple triggered RPC requests sent and prevent being rate limited, and ultimately create a slightly better development process.
The initial example for useReadContract shows how a hook that fires the request right away. The dilemma is when a developer has multiple useReadContracts in the same file and aren't seeing how to avoid triggering a request right away.
This can then lead to developers handling the hook with another hook (aka
useEffect
) or placing each of theseuseReadContract
hooks in their own components and not showing it until it's absolutely needed, which leads to excessive React components.Example
From an RPC perspective, if the app is reliant on the injected provider, and has multiple requests, there is a good chance that they will start to get rate limited because of mishandling of requests.
Proposed Solution
Show in the usage section, another example with "controlled requests" / "alternative approach" (open to suggestions on the name) to show that new devs don't have to overcome this with additional hooks, or multiple components.
Where did you find it?
The text was updated successfully, but these errors were encountered: