Closed briandoyle81CB closed 1 week ago
The relevant code is here: https://github.com/briandoyle81CB/dao-gate/blob/main/src/app/page.tsx
Spent some time trying to reproduce and wasn't able to unfortunately (sounds like there might be a race condition from what you described). Happy to look into this further if there's some way to consistently reproduce. Also, curious about the following.
Thanks for looking! I'm hopeful that this is a random edge case, but worried about it being too common - seen in about half of the 8-12 browser/machine combos we've tested, with > half machines showing the fail state on at least one browser.
But this is using the way I'm teaching how to use useReadContract
(https://docs.base.org/base-camp/docs/reading-and-displaying-data/configuring-useReadContract) and we haven't seen or heard something like this reported before, or experienced it ourselves.
Do you see anything less than optimal in the implementation?: https://github.com/briandoyle81CB/dao-gate/blob/main/src/app/page.tsx
0x038ee341181e1090159eab1f4ba2c28f4b50330d
and 0x354ef633fb3ba2c427f18fc39fcf96a31d0fd577
, with no patterns on fail or success with either contract
Check existing issues
Describe the bug
Hello! I'm using
useReadContract
to read thebalanceOf
an NFT contract for a providedaddress
.On some computers, or even different browsers on the same computer, the code works as expected.
Without modification, on others, it does not ever update
data
. This persists even if theaddress
parameter is hardcoded.Changing the contract, or other minor parts of the code can flip a computer or browser from working to non-working, or vice versa. Otherwise, the issue is consistent. It will always work on a given computer/browser combo, or it will never work.
Further testing shows that the
isPending
state is being triggered on non-working computers, butdata
never updates fromundefined
Invalidating the query also does not trigger
data
being populated.Link to Minimal Reproducible Example
https://github.com/briandoyle81CB/dao-gate
Steps To Reproduce
bun install
bun run dev
balanceData
useEffect
is never triggeredsrc/app/page.tsx
and hardcode your address as the argument foruseReadContract
data
is never returned.If it doesn't fail, try again on a different browser and/or computer
RE Dependencies, the project only has wagmi/cli @latest, which is installing 2.9.11
What Wagmi package(s) are you using?
wagmi
Wagmi Version
2.9.11
Viem Version
1.1.4
TypeScript Version
5.3.3
Anything else?
No response