[bug] useContractRead not returning key/value pairs after second page refresh
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Package Version
0.3.5
Current Behavior
Hey all,
I was using useContractWrite
to write something to my local Hardhat, and then refreshed the page which triggers useContractRead
and noticed that first refresh I get the following (note the key/value pairs):
And then I refresh the page again, and I get this (no key/value pairs) in the console:
Is there something obvious I’m missing as to why the key/value pairs disappear after a couple refreshes when I’m returning an array of structs? Or is this a bug?
Also not sure if this is an ethers
issue or if it’s a wagmi
issue.
Expected Behavior
The expected behavior is for it to return the struct with key/value pairs like so:
Steps To Reproduce
No response
Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)
No response
Anything else?
No response
Issue Analytics
- State:
- Created a year ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
useContract returning Contract, useContractRead ... - GitHub
If I drop the contract function reference from the hook there is no change in the data, error and loading output. What could...
Read more >useContractRead - Wagmi
Name of function to call. If functionName is not defined, hook will not run. import { useContractRead } from 'wagmi' function App() {...
Read more >Read and Write on the Blockchain with Next,js and Wagmi v0.4
After the transaction gets mined, you can refresh the page to see the new greeting. This is how it looks: Extra Options to...
Read more >React redirect to another page in function - Discover Sauerland
The default behavior is to redirect the user to the sign-in page, from where - after a successful login - they will be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jxom @tmm I’ve updated my CodeSandbox (https://codesandbox.io/s/ethers-vs-wagmi-d6tq9z?file=/src/App.tsx) to use the new release (0.4.10) after the PR was merged for this issue, but it seems it has not fixed the issue.
wagmi.cache
still stores the arrays without the key/value pairs and it seems a bug has been introduced.If you pull up the console, you’ll see this now:
Note the new 3rd array key/value pair (null: Array). Previously this was just 2 arrays without the missing key/value pairs that Ethers returns correctly.
Again, here’s what Ethers returns, and I assume
useContractRead
fromwagmi
should return:Should I raise a new issue or can this issue be re-opened?
Thank you for looking into this. Raised a PR for a fix #552.