Skip to content

feat(vue-query): add 'mutationOptions'#10381

Draft
sukvvon wants to merge 6 commits intomainfrom
feat/vue-query-mutationOptions
Draft

feat(vue-query): add 'mutationOptions'#10381
sukvvon wants to merge 6 commits intomainfrom
feat/vue-query-mutationOptions

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 4, 2026

🎯 Changes

  • Add mutationOptions helper function for type-safe mutation option creation in vue-query
  • Add VueMutationOptions type to types.ts (follows SolidMutationOptions naming pattern)
  • Refactor UseMutationOptionsBase in useMutation.ts to use VueMutationOptions from types.ts
  • Add runtime tests (17 tests) and type tests (13 tests)

✅ 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 mutationOptions helper function for Vue Query mutations with improved type safety.
    • New VueMutationOptions type for standardized mutation configuration with optional mutationKey support.
  • Tests

    • Added comprehensive test suite validating mutation options behavior, type inference, concurrent mutations, filtering, and state management integration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 4, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f72c24eb-7dba-4f9d-8187-fa4ac471df18

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR introduces a new mutationOptions helper function for Vue Query that preserves generic types for mutation configuration, extracts the Vue-specific options type as VueMutationOptions, refactors useMutation to use this new type for consistency, and includes comprehensive test coverage for type safety and runtime behavior.

Changes

Cohort / File(s) Summary
Versioning
.changeset/many-symbols-write.md
Documents minor version bump for the new mutationOptions feature.
New Helper & Types
packages/vue-query/src/mutationOptions.ts, packages/vue-query/src/types.ts
Adds mutationOptions identity helper with overloads to preserve generic types; introduces VueMutationOptions type combining MutationObserverOptions with Vue's shallow reactivity option.
Test Coverage
packages/vue-query/src/__tests__/mutationOptions.test-d.ts, packages/vue-query/src/__tests__/mutationOptions.test.ts
Type assertions validating compile-time behavior (excess property rejection, generic inference, callback typing); runtime tests covering mutation in-flight counting, state queries, filtering by key, and shallow reactivity.
Integration & Refactoring
packages/vue-query/src/index.ts, packages/vue-query/src/useMutation.ts
Exports mutationOptions function and VueMutationOptions type; refactors useMutation to depend on consolidated VueMutationOptions type instead of inline construction.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 hops with glee

A helper so keen, preserving each type,
Options flow smooth through mutations so ripe,
Generic types dance in their rightful place,
With tests that ensure no type errors trace!

🚥 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 describes the main change: adding a 'mutationOptions' helper function to vue-query, which aligns with the core feature introduced across multiple files in the changeset.
Description check ✅ Passed The description covers all required template sections with substantive content: changes are detailed, checklist items are addressed, and release impact is clearly marked. The changeset was properly generated for this published code change.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/vue-query-mutationOptions

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 4, 2026

View your CI Pipeline Execution ↗ for commit 6d6ebe0

Command Status Duration Result
nx run-many --target=build --exclude=examples/*... ✅ Succeeded <1s View ↗
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 24s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-06 10:57:27 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

🚀 Changeset Version Preview

1 package(s) bumped directly, 23 bumped as dependents.

🟨 Minor bumps

Package Version Reason
@tanstack/vue-query 5.96.2 → 5.97.0 Changeset
@tanstack/angular-query-experimental 5.96.2 → 5.97.0 Dependent
@tanstack/angular-query-persist-client 5.96.2 → 5.97.0 Dependent
@tanstack/eslint-plugin-query 5.96.2 → 5.97.0 Dependent
@tanstack/preact-query 5.96.2 → 5.97.0 Dependent
@tanstack/preact-query-devtools 5.96.2 → 5.97.0 Dependent
@tanstack/preact-query-persist-client 5.96.2 → 5.97.0 Dependent
@tanstack/query-async-storage-persister 5.96.2 → 5.97.0 Dependent
@tanstack/query-broadcast-client-experimental 5.96.2 → 5.97.0 Dependent
@tanstack/query-core 5.96.2 → 5.97.0 Dependent
@tanstack/query-devtools 5.96.2 → 5.97.0 Dependent
@tanstack/query-persist-client-core 5.96.2 → 5.97.0 Dependent
@tanstack/query-sync-storage-persister 5.96.2 → 5.97.0 Dependent
@tanstack/react-query 5.96.2 → 5.97.0 Dependent
@tanstack/react-query-devtools 5.96.2 → 5.97.0 Dependent
@tanstack/react-query-next-experimental 5.96.2 → 5.97.0 Dependent
@tanstack/react-query-persist-client 5.96.2 → 5.97.0 Dependent
@tanstack/solid-query 5.96.2 → 5.97.0 Dependent
@tanstack/solid-query-devtools 5.96.2 → 5.97.0 Dependent
@tanstack/solid-query-persist-client 5.96.2 → 5.97.0 Dependent

🟩 Patch bumps

Package Version Reason
@tanstack/svelte-query 6.1.13 → 6.1.14 Dependent
@tanstack/svelte-query-devtools 6.1.13 → 6.1.14 Dependent
@tanstack/svelte-query-persist-client 6.1.13 → 6.1.14 Dependent
@tanstack/vue-query-devtools 6.1.13 → 6.1.14 Dependent

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 4, 2026

More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10381

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10381

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10381

@tanstack/preact-query-devtools

npm i https://pkg.pr.new/@tanstack/preact-query-devtools@10381

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10381

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10381

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10381

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@10381

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@10381

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10381

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10381

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@10381

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@10381

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10381

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10381

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@10381

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@10381

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10381

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@10381

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@10381

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10381

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@10381

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@10381

commit: 6d6ebe0

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

size-limit report 📦

Path Size
react full 11.98 KB (0%)
react minimal 9.01 KB (0%)

@sukvvon sukvvon requested a review from DamianOsipiuk April 4, 2026 05:47
@sukvvon sukvvon self-assigned this Apr 4, 2026
@sukvvon sukvvon marked this pull request as draft April 6, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant