-
Notifications
You must be signed in to change notification settings - Fork 619
Adds options refetchInterval and retry params to useReadContract #3273
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: e099ef5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
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 |
|
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @gregfromstl and the rest of your teammates on |
CodSpeed Performance ReportMerging #3273 will improve performances by 12%Comparing Summary
Benchmarks breakdown
|
size-limit report 📦
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3273 +/- ##
=======================================
Coverage 63.26% 63.26%
=======================================
Files 833 833
Lines 63328 63328
Branches 3433 3433
=======================================
Hits 40066 40066
Misses 22587 22587
Partials 675 675
*This pull request uses carry forward flags. Click here to find out more. |
| Pick<UseQueryOptions, "enabled"> & { | ||
| refetchInterval?: number; | ||
| retry?: number; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it make more sense to just ad these to the Pick ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially tried that but react query had some janky types that were causing issues

Problem solved
This PR addresses the need for more flexible configuration options when using the
useReadContracthook. By addingrefetchIntervalandretryparameters, users can customize the frequency of refetching data and the number of retry attempts on failure, respectively. These options improve the robustness and flexibility of theuseReadContracthook when interacting with contracts.Changes made
useReadContractnow acceptsrefetchIntervalandretryas optional parameters.PickedQueryOptionstype has been updated to include the new parameters.How to test
useReadContractwith different values forrefetchIntervalandretryand verify it behaves as expected.