Skip to content

fix(react): allow code in generated read hooks - #5262

Open
cruzdanilo wants to merge 1 commit into
wevm:mainfrom
cruzdanilo:deployless
Open

cruzdanilo wants to merge 1 commit into
wevm:mainfrom
cruzdanilo:deployless

Conversation

@cruzdanilo

Copy link
Copy Markdown
Contributor

#5020 types the parameters of createUseReadContract hooks as Partial<Omit<ReadContractParameters<...>, 'abi' | 'address' | 'functionName' | 'args'>>. viem's ReadContractParameters is a union: the deployless branch has code and no address, the other one has address. Omit isn't distributive (keyof a union keeps only the keys every branch shares), so code drops out, and since 3.6.1 generated hooks reject deployless reads at the type level. they still forward code at runtime, and useReadContract accepts it.

this swaps Omit for UnionStrictOmit, which omits the same keys from each branch, so code survives without bringing back the duplicate autocomplete entries #5020 removed. emitted js is unchanged.

createReadContract in @wagmi/core already uses UnionStrictOmit and accepts code. @wagmi/vue and @wagmi/solid have no codegen hooks.

the new deployless read (bytecode) type test mirrors the one in useReadContract.test-d.ts and fails without this change.

@vercel

vercel Bot commented Oct 20, 2026

Copy link
Copy Markdown

@cruzdanilo is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-20T20:20:59.872721Z c66a61d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@changeset-bot

changeset-bot Bot commented Oct 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c66a61d

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

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@pkg-pr-new

pkg-pr-new Bot commented Oct 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

@wagmi/cli

npm i https://pkg.pr.new/@wagmi/cli@5262

@wagmi/connectors

npm i https://pkg.pr.new/@wagmi/connectors@5262

@wagmi/core

npm i https://pkg.pr.new/@wagmi/core@5262

create-wagmi

npm i https://pkg.pr.new/create-wagmi@5262

wagmi

npm i https://pkg.pr.new/wagmi@5262

@wagmi/solid

npm i https://pkg.pr.new/@wagmi/solid@5262

@wagmi/vue

npm i https://pkg.pr.new/@wagmi/vue@5262

commit: c66a61d

@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 22.43%. Comparing base (6233e18) to head (c66a61d).

❗ There is a different number of reports uploaded between BASE (6233e18) and HEAD (c66a61d). Click for more details.

HEAD has 4 uploads less than BASE
Flag BASE (6233e18) HEAD (c66a61d)
7 3
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5262       +/-   ##
===========================================
- Coverage   88.71%   22.43%   -66.29%     
===========================================
  Files         303      222       -81     
  Lines        2817     2131      -686     
  Branches      818      651      -167     
===========================================
- Hits         2499      478     -2021     
- Misses        122     1573     +1451     
+ Partials      196       80      -116     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

cruzdanilo added a commit to exactly/exa that referenced this pull request Oct 20, 2026
wagmi 3.6.1 (wevm/wagmi#5020) builds codegen read hook parameters
with a non-distributive omit of viem's read contract parameters, so
generated hooks no longer accept `code`. deployless reads call
`useReadContract` with the abi and function name instead, until
wevm/wagmi#5262 restores `code` in the generated hooks.

wagmi pins use-sync-external-store 1.4.0 while the rest of the tree
resolves 1.6.0, so zustand's optional peer split @wagmi/core into two
copies. `WagmiProvider` and the hooks ran on one copy, while our
`reconnect` and `@wagmi/core/actions` imports ran on the other, with
separate module state and both copies in the web bundle. the override
on use-sync-external-store 1.4.0 dedupes it.
cruzdanilo added a commit to exactly/exa that referenced this pull request Oct 20, 2026
wagmi 3.6.1 (wevm/wagmi#5020) builds codegen read hook parameters
with a non-distributive omit of viem's read contract parameters, so
generated hooks no longer accept `code`. deployless reads call
`useReadContract` with the abi and function name instead, until
wevm/wagmi#5262 restores `code` in the generated hooks.

wagmi pins use-sync-external-store 1.4.0 while the rest of the tree
resolves 1.6.0, so zustand's optional peer split @wagmi/core into two
copies. `WagmiProvider` and the hooks ran on one copy, while our
`reconnect` and `@wagmi/core/actions` imports ran on the other, with
separate module state and both copies in the web bundle. the override
on use-sync-external-store 1.4.0 dedupes it.

This branch has not been deployed

No deployments
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.

1 participant