Closed 0x33dm closed 2 months ago
I tried to make a new reproductionable example on https://new.wagmi.sh/ but no matter what I do the page is rendered blank.
Tried the latest OPERA and latest CHROME both ended up with a blank page.
Can you share the contract address and ABI so someone that helps doesn't need to manually type the address and look for the ABI?
Can you share the contract address and ABI so someone that helps doesn't need to manually type the address and look for the ABI?
get_pending_market_state_for_account
assert coll_change > 0 and debt_change > 0, "DFM:C 0 coll or debt"
I believe deploying this contract on a test net / local network would be a little to complicated, so would be better to write a simple contract with a parameter that triggers the failed assert.
I tried to make a new reproductionable example on https://new.wagmi.sh/ but no matter what I do the page is rendered blank.
Tried the latest OPERA and latest CHROME both ended up with a blank page.
This is a silly thing but try using VPN, or different internet connections as well. Been in similar situation, turned out the ISP/WiFi was blocking those APIs (try ping-ing).
This is a silly thing but try using VPN, or different internet connections as well. Been in similar situation, turned out the ISP/WiFi was blocking those APIs (try ping-ing).
I could understand how ad-blockers could potentially block something. and i tried on incognito browser..
would be really weird if it was my ISP blocking something
Wasn't able to reproduce. TanStack Query has aggressive caching defaults so likely something you need to tune there.
With refetchOnWindowFocus
switch on, can trigger refetching automatically when window refocuses.
useReadContract({
// ...
query: {
refetchOnWindowFocus: true,
},
})
https://github.com/wevm/wagmi/assets/6759464/62c14475-7aaf-4df8-ba30-2f47b401350e
With
refetchOnWindowFocus
switch on, can trigger refetching automatically when window refocuses.useReadContract({ // ... query: { refetchOnWindowFocus: true, }, })
sure, I know that, but I don't understand how this is related to my issue.
Anyway, I understand that it's probably possible to overwrite this behaviour, for instance, by manually checking if it reverts, and if it does, then setting the cache to an empty state of some sort directly via RQuery API instead of wagmi.
I'm just wondering if that shouldn't be wagmi default behaviour, to overwrite the cache with some variation of "undefined" instead of having the previous contract response.
Can you provide a GitHub repo with a minimal reproduction (with clear steps) that you are experiencing this with? (You can use pnpm create wagmi
to kickstart the repo.)
We might be talking about different things so want to make sure we are aligned before I spend anymore time on this. Wagmi doesn't do anything special other than pass through options to Viem via TanStack Query.
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 questions or comments you can create a new discussion thread.
Describe the bug
Problem
I'm using useReadContract in order to have live updates from a variable called
account_debt
, in order to fetch that data I read a "view" method on a smart contract calledget_pending_market_state_for_account
.The way the view functions works is:
account_debt
The natural user flow on the application goes as this:
The problem is when a user pays the debt on step (3) the UI never returns to (1), because:
account_debt
is nullnull
because ( I assume ) Wagmi won't update the data if the contract starts reverting with the same params?Debugging
When I look at the ReactQueryDevTools on the stuck page I can see this and it NEVER changes even though I see the "fetch" happening often, the cached data is always here.
If I press the blue button "Trigger Loading" then the data is updated and becomes "null" again ( which is the original state ).
Questions
Link to Minimal Reproducible Example
https://stackblitz.com/edit/new-wagmi?file=src%2FApp.tsx
Steps To Reproduce
Described on the preview comment
Wagmi Version
2.8.1
Viem Version
2.10.2
TypeScript Version
5.4.5
Check existing issues
Anything else?
To reproduce the error I would need to send some test tokens on FTM + FTM for gas and I think it's not needed in this case as the problem is well explained.
Thanks a lot for your hard work on the library!