Skip to content

test(query-core/queryClient): add test for 'getMutationDefaults' matching only relevant mutation defaults#10099

Open
sukvvon wants to merge 1 commit intoTanStack:mainfrom
sukvvon:test/query-core-queryClient-getMutationDefaults-matching
Open

test(query-core/queryClient): add test for 'getMutationDefaults' matching only relevant mutation defaults#10099
sukvvon wants to merge 1 commit intoTanStack:mainfrom
sukvvon:test/query-core-queryClient-getMutationDefaults-matching

Conversation

@sukvvon
Copy link
Contributor

@sukvvon sukvvon commented Feb 6, 2026

🎯 Changes

  • Add test to verify that getMutationDefaults returns only matching defaults when multiple mutation defaults are set with different keys
  • Covers the partialMatchKey false branch in getMutationDefaults forEach loop

✅ 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 test coverage to verify that mutation default options are correctly stored and retrieved independently for different configurations.

@changeset-bot
Copy link

changeset-bot bot commented Feb 6, 2026

⚠️ No Changeset found

Latest commit: aecfeff

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

A unit test was added to the query-core test suite to verify that mutation default options are independently stored and retrieved per key, with no production code modifications.

Changes

Cohort / File(s) Summary
Test Coverage
packages/query-core/src/__tests__/queryClient.test.tsx
Added a test case under setMutationDefaults that validates separate mutation default options can be stored and retrieved independently for different keys.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

package: query-core

Suggested reviewers

  • TkDodo

Poem

🐰 A test hops in with defaults so keen,
Each mutation key gets its own machine,
Options stored, retrieved just right,
Separate paths shining bright! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a test for getMutationDefaults to verify it matches only relevant mutation defaults.
Description check ✅ Passed The description follows the required template structure with all sections completed: Changes section details the test purpose, Checklist items are marked appropriately, and Release Impact correctly identifies this as dev-only.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@nx-cloud
Copy link

nx-cloud bot commented Feb 6, 2026

View your CI Pipeline Execution ↗ for commit aecfeff

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

☁️ Nx Cloud last updated this comment at 2026-02-06 02:11:44 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 6, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: aecfeff

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