Skip to content

Conversation

@shincurry
Copy link

@shincurry shincurry commented Jan 14, 2026

🎯 Changes

  • New method mutationOptions
  • New type helpers: DeepUnwrapRefOrGetter, MaybeRefDeepOrGetter
  • New tests for mutationOptions (Generated by Claude Opus 4.5)
  • New docs for mutationOptions (Copied from react-query)

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • New Features

    • Added a new mutationOptions helper to improve type inference and validation when configuring mutations, with support for optional and required mutation keys.
  • Documentation

    • Added a reference page with usage examples and supported configuration options.
  • Tests

    • Added extensive type and runtime tests covering mutationOptions and related mutation hooks.
  • Chores

    • Exposed mutationOptions in the public API and refined related type utilities.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Jan 14, 2026

🦋 Changeset detected

Latest commit: a04bdff

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

This PR includes changesets to release 2 packages
Name Type
@tanstack/vue-query Minor
@tanstack/vue-query-devtools Major

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

@github-actions github-actions bot added documentation Improvements or additions to documentation package: vue-query labels Jan 14, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 14, 2026

📝 Walkthrough

Walkthrough

Adds a new type-level helper mutationOptions to @tanstack/vue-query, new type utilities to support option getters, updates useMutation typings to use the getter-aware types, adds public export and docs, and introduces comprehensive TypeScript and runtime tests validating typing and runtime interactions (useIsMutating, useMutationState).

Changes

Cohort / File(s) Summary
Type system extensions
packages/vue-query/src/types.ts
Added MaybeRefDeepOrGetter<T> and DeepUnwrapRefOrGetter<T> to support getters that return maybe-ref-deep values and to unwrap function-returned refs for typing.
Core implementation
packages/vue-query/src/mutationOptions.ts
New mutationOptions function with three overloads to accept getter/ref-wrapped UseMutationOptions (with or without mutationKey) and return the same shape; runtime implementation is a pass-through.
API export & integration
packages/vue-query/src/index.ts, packages/vue-query/src/useMutation.ts
Exported mutationOptions from the package index. Updated useMutation to use MaybeRefDeepOrGetter (replacing the prior union) for its UseMutationOptions type.
Type tests
packages/vue-query/src/__tests__/mutationOptions.test-d.ts
New TypeScript-only tests asserting type inference, generics, context propagation, negative checks, and interactions with useMutation/useIsMutating/useMutationState.
Runtime tests
packages/vue-query/src/__tests__/mutationOptions.test.ts
New runtime tests covering identity behavior, concurrent mutation counting, filtering by mutationKey, useMutationState emissions, scope disposal, and coordination with queryClient.isMutating.
Documentation
docs/framework/vue/reference/mutationOptions.md
New reference doc explaining mutationOptions usage and linking to useMutation options.
Changeset
.changeset/lucky-numbers-change.md
New changeset recording a minor bump and describing the mutationOptions feature.

Sequence Diagram(s)

(Skipped — changes are primarily type-level additions, API export, and tests; no new multi-component runtime control flow requiring visualization.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 I nibble types and stitch them tight,
Getters and refs snug in sight,
mutationOptions hops into view,
Tests and docs say "how do you do?",
A tiny rabbit cheers for you! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a new mutationOptions feature to vue-query.
Description check ✅ Passed The PR description follows the required template with all sections completed: Changes section lists the new features, Checklist is fully marked, and Release Impact confirms a changeset was generated.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@shincurry shincurry marked this pull request as draft January 14, 2026 07:25
@shincurry shincurry marked this pull request as ready for review January 14, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation package: vue-query

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant