Skip to content

test(vue-query/mutationOptions): add 'useMutationState' tests for getter overloads#10472

Merged
sukvvon merged 1 commit intomainfrom
test/vue-query-mutationOptions-getter-useMutationState
Apr 13, 2026
Merged

test(vue-query/mutationOptions): add 'useMutationState' tests for getter overloads#10472
sukvvon merged 1 commit intomainfrom
test/vue-query-mutationOptions-getter-useMutationState

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 13, 2026

🎯 Changes

  • Add 3 runtime tests for mutationOptions getter overloads with useMutationState:
    • should return mutation states when used with useMutationState (getter without mutationKey in mutationOptions)
    • should return mutation states when used with useMutationState (getter): multiple mutations with getter
    • should return mutation states when used with useMutationState (getter, filter mutationOpts1.mutationKey): filter by mutationKey with getter

✅ 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

  • Tests
    • Added three new test cases validating mutation state behavior with getter-based options, covering scenarios with and without mutation keys, state filtering, and key resolution.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ad18e56c-8db9-42eb-abc6-95bfdc7918d0

📥 Commits

Reviewing files that changed from the base of the PR and between 8fc02cc and 74409cc.

📒 Files selected for processing (1)
  • packages/vue-query/src/__tests__/mutationOptions.test.ts

📝 Walkthrough

Walkthrough

Added three Vitest test cases for useMutationState validating behavior when mutationOptions is provided as a getter function. Tests verify getter resolution without mutationKey, with distinct mutationKey values, and with mutationKey filtering for mutation-state retrieval.

Changes

Cohort / File(s) Summary
Test Coverage for Getter-Based mutationOptions
packages/vue-query/src/__tests__/mutationOptions.test.ts
Added three test cases covering useMutationState with mutationOptions as a getter: (1) getter without mutationKey verifying empty initial state and state accumulation; (2) getter with distinct mutationKey values for multiple mutations; (3) getter with mutationKey filtering by resolved key value.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

package: vue-query

Poem

🐰 Getter functions get their due,
Tests now prove the states ring true,
With keys aligned and flows so clear,
Mutation mutations have naught to fear! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding tests for 'useMutationState' with getter overloads for 'mutationOptions'.
Description check ✅ Passed The pull request description follows the template structure with all required sections completed, including a detailed explanation of changes and a properly filled checklist with appropriate selections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/vue-query-mutationOptions-getter-useMutationState

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 13, 2026

View your CI Pipeline Execution ↗ for commit 74409cc

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

☁️ Nx Cloud last updated this comment at 2026-04-13 02:59:56 UTC

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 13, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 74409cc

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 11.99 KB (0%)
react minimal 9.02 KB (0%)

@sukvvon sukvvon merged commit c8de088 into main Apr 13, 2026
10 checks passed
@sukvvon sukvvon deleted the test/vue-query-mutationOptions-getter-useMutationState branch April 13, 2026 03:01
@sukvvon sukvvon self-assigned this Apr 13, 2026
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