Skip to content
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

BigInt serialization issue in useReadContract/useReadContracts hooks #4322

Closed
1 task done
nakedfool opened this issue Oct 8, 2024 · 5 comments · Fixed by TanStack/query#8151
Closed
1 task done
Labels
Needs Reproduction Misc: Needs Reproduction

Comments

@nakedfool
Copy link

Check existing issues

Describe the bug

After updating @tanstack/react-query to version 5.59.0, I've encountered a critical issue with the useReadContract and useReadContracts hooks from wagmi.

When attempting to pass a BigInt value as an argument to any read function, the following error occurs:
typeerror: do not know how to serialize a bigint

This error also leads to unexpected behaviour from hook:

  1. it results in a BSOD.
  2. the error appears to be a silent failure - neither a boolean nor an error object is received from the hooks and therefore a BSOD.

There is a discussion already on wagmi discord and a possible workaround for this type of issue, but i would love to see if there is a way for wagmi team to patch it so we do not need to introduce workarounds in our codebase, see discussion here

Link to Minimal Reproducible Example

No response

Steps To Reproduce

  1. Update @tanstack/react-query to version 5.59.0
  2. Pass any BigInt value to the either useReadContract or useReadContracts

What Wagmi package(s) are you using?

wagmi

Wagmi Package(s) Version(s)

2.12.17

Viem Version

2.21.16

TypeScript Version

No response

Anything else?

No response

Copy link
Contributor

github-actions bot commented Oct 8, 2024

Hello @nakedfool.

Please provide a minimal reproduction using StackBlitz, TypeScript Playground (for type issues), or a separate minimal GitHub repository.

Minimal reproductions are required as they save us a lot of time reproducing your config/environment and issue, and allow us to help you faster.

Once a minimal reproduction is added, a team member will confirm it works, then re-open the issue.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2024
@rocketman-21
Copy link

rocketman-21 commented Oct 8, 2024

Also running into this as of today. Might be helpful @nakedfool #3855

Here's my MRE https://github.com/wkocjan/nouns-flows/pull/25/files

Edit:
Downgrading tanstack to 5.56.2 seemed to help

@jxom
Copy link
Member

jxom commented Oct 8, 2024

Opened a fix: TanStack/query#8151

@jxom
Copy link
Member

jxom commented Oct 9, 2024

Please upgrade to @tanstack/[email protected]

Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs Reproduction Misc: Needs Reproduction
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants