Repository navigation
fix(react): allow code in generated read hooks - #5262
cruzdanilo wants to merge 1 commit into
Conversation
|
@cruzdanilo is attempting to deploy a commit to the Wevm Team on Vercel. A member of the Team first needs to authorize it. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🦋 Changeset detectedLatest commit: c66a61d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
@wagmi/cli
@wagmi/connectors
@wagmi/core
create-wagmi
wagmi
@wagmi/solid
@wagmi/vue
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests.
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. 🚀 New features to boost your workflow:
|
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.
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.
#5020 types the parameters of
createUseReadContracthooks asPartial<Omit<ReadContractParameters<...>, 'abi' | 'address' | 'functionName' | 'args'>>. viem'sReadContractParametersis a union: the deployless branch hascodeand noaddress, the other one hasaddress.Omitisn't distributive (keyofa union keeps only the keys every branch shares), socodedrops out, and since 3.6.1 generated hooks reject deployless reads at the type level. they still forwardcodeat runtime, anduseReadContractaccepts it.this swaps
OmitforUnionStrictOmit, which omits the same keys from each branch, socodesurvives without bringing back the duplicate autocomplete entries #5020 removed. emitted js is unchanged.createReadContractin@wagmi/corealready usesUnionStrictOmitand acceptscode.@wagmi/vueand@wagmi/solidhave no codegen hooks.the new
deployless read (bytecode)type test mirrors the one inuseReadContract.test-d.tsand fails without this change.