Error on a contract client that predates unwrap() - #830
Conversation
…ract client that predates unwrap() Generated hooks now call unwrap() on the client's result, added to plugin-fetch and plugin-axios in 5.2.0. An older client plugin generated a client without unwrap(), so the hooks failed at runtime with no clear cause. resolveContractClient now checks the registered client plugin's installed version and throws a diagnostic naming the required version during setup instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018r9FQxbCd8tL7Npvu8khvL
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
◈ PR Lens
Architecture 5 components touched across 5 lanes. Data flow
Drill down
|
🦋 Changeset detectedLatest commit: 4aeaaac The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Folds the package-version lookup and comparison directly into resolveClient.ts instead of a separate module, and drops the plugin-mcp change beyond the required root parameter, since it does not call unwrap(). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018r9FQxbCd8tL7Npvu8khvL
More templates
@kubb/plugin-axios
@kubb/plugin-cypress
@kubb/plugin-faker
@kubb/plugin-fetch
@kubb/plugin-mcp
@kubb/plugin-msw
@kubb/plugin-react-query
@kubb/plugin-redoc
@kubb/plugin-swr
@kubb/plugin-ts
@kubb/plugin-vue-query
@kubb/plugin-zod
commit: |
|
Size Change: +5.25 kB (+1.68%) Total Size: 318 kB 📦 View Changed
ℹ️ View Unchanged
|
Changes
plugin-react-query,plugin-vue-query, andplugin-swrbuild their generated hooks onunwrap(), a methodplugin-fetchandplugin-axiosonly started attaching to theirRequestResultpromise in5.2.0(#829). With an olderplugin-fetchorplugin-axios, the generated hooks called a method that did not exist, and failed at runtime with no clear cause.resolveContractClient(internals/client/src/resolveClient.ts) now takes arequireUnwrapflag. When set, it reads the resolved client plugin's installed version from the user's project (internals/client/src/resolvePackageVersion.ts) and throws during setup when it predates5.2.0:plugin-react-query,plugin-vue-query, andplugin-swrpassrequireUnwrap: true.plugin-mcpdoes not callunwrap(), so it keeps the existing behavior and only picks up the new requiredrootparameter.Checklist
pnpm run test.Release Impact
🤖 Generated with Claude Code
https://claude.ai/code/session_018r9FQxbCd8tL7Npvu8khvL
Generated by Claude Code