Skip to content

fix(openapi-react-query): mutation results type#2519

Merged
drwpow merged 1 commit intoopenapi-ts:mainfrom
sacha-c:fix-mutatation-results-types
Feb 8, 2026
Merged

fix(openapi-react-query): mutation results type#2519
drwpow merged 1 commit intoopenapi-ts:mainfrom
sacha-c:fix-mutatation-results-types

Conversation

@sacha-c
Copy link
Contributor

@sacha-c sacha-c commented Nov 4, 2025

Changes

Adds proper types to the useMutation's onMutateResults fields which are used in onSettled, onError & return object of this hook.

The open issue regarding this bug: #2518

I ended up digging further & this seems to fix it, but looking forward for a second pair of eyes to check that my fix is correct 🙂

Here I moved the Options type definition from the generic parameters to the actual options parameter themselves, thus not setting the UseMutationOptions's TOnMutateResult to the default unknown.

How to Review

Checklist

  • Unit tests updated
  • docs/ updated (if necessary)
  • pnpm run update:examples run (only applicable for openapi-typescript)

@sacha-c sacha-c requested a review from a team as a code owner November 4, 2025 20:06
@sacha-c sacha-c requested a review from htunnicliff November 4, 2025 20:06
@netlify
Copy link

netlify bot commented Nov 4, 2025

👷 Deploy request for openapi-ts pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit bec703f

@changeset-bot
Copy link

changeset-bot bot commented Nov 4, 2025

🦋 Changeset detected

Latest commit: bec703f

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

This PR includes changesets to release 1 package
Name Type
openapi-react-query 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

@sacha-c
Copy link
Contributor Author

sacha-c commented Nov 8, 2025

Tests fail due to a refactor in Redocly's test folder structure (unrelated to this PR's change), I've opened a separate PR to address that here #2522

@sacha-c sacha-c force-pushed the fix-mutatation-results-types branch from 282876f to ded751e Compare December 3, 2025 18:24
@BPreisner
Copy link

@htunnicliff could you please merge this PR? 🙏🏼

@drwpow
Copy link
Contributor

drwpow commented Feb 8, 2026

Thanks for adding! Could you please add a changeset (see comment)?

@sacha-c sacha-c force-pushed the fix-mutatation-results-types branch from ded751e to bec703f Compare February 8, 2026 19:22
@sacha-c
Copy link
Contributor Author

sacha-c commented Feb 8, 2026

Thanks for adding! Could you please add a changeset (see comment)?

Thanks for checking this PR! I've updated the branch & added the changset 👍

@drwpow drwpow merged commit 681ac87 into openapi-ts:main Feb 8, 2026
7 checks passed
This was referenced Feb 8, 2026
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.

3 participants