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

Fix: pass config parameter to useConnectorClient in useSimulateContract and useEstimateGas #4447

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

Aerilym
Copy link
Contributor

@Aerilym Aerilym commented Dec 9, 2024

Added the config parameter to useConnectorClient parameters when used in useSimulateContract and useEstimateGas. useConnectorClient would always call useConfig as config wasn't provided in the parameters, this broke providing a config to either hook and would mean useConfig was triggered in both hooks. This caused an error when WagmiProvider wasn't available in the context, as useConnectorClient would call useContext(WagmiContext) even if a config parameter was provided to the parent hooks.

Copy link

changeset-bot bot commented Dec 9, 2024

🦋 Changeset detected

Latest commit: 7ec2998

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wagmi Patch

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

Copy link

vercel bot commented Dec 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
wagmi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 9, 2024 6:10am

@Aerilym
Copy link
Contributor Author

Aerilym commented Dec 9, 2024

Looks like some of the tests are throwing errors, not 100% if its an issue with my changes or with the tests, will take a look.

@Aerilym
Copy link
Contributor Author

Aerilym commented Dec 9, 2024

Ran the tests locally, looks like 2 tests are timing out, and as far as i can tell the issue is unrelated to the code changes:

 FAIL  |@wagmi/core| packages/core/src/actions/getBlock.test.ts > default
 FAIL  |@wagmi/core| packages/core/src/actions/getBlock.test.ts > args: blockNumber
 FAIL  |@wagmi/core| packages/core/src/actions/getBlock.test.ts > args: includeTransactions
 
 FAIL  |wagmi| packages/react/src/hooks/useInfiniteReadContracts.test.ts > default

Copy link
Member

@tmm tmm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

"wagmi": patch
---

Fixed config parameter passing in useSimulateContract and useEstimateGas
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Fixed config parameter passing in useSimulateContract and useEstimateGas
Fixed `useSimulateContract` and `useEstimateGas` behavior by passing `config` parameter to internal `useConnectorClient`.

@tmm tmm merged commit 244f777 into wevm:main Dec 9, 2024
8 of 12 checks passed
@github-actions github-actions bot mentioned this pull request Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants