Skip to content

test(query-core/mutationCache): add test for 'remove' splicing target mutation from scope with multiple mutations#10103

Open
sukvvon wants to merge 1 commit intoTanStack:mainfrom
sukvvon:test/query-core-mutationCache-remove-scoped-mutation
Open

test(query-core/mutationCache): add test for 'remove' splicing target mutation from scope with multiple mutations#10103
sukvvon wants to merge 1 commit intoTanStack:mainfrom
sukvvon:test/query-core-mutationCache-remove-scoped-mutation

Conversation

@sukvvon
Copy link
Contributor

@sukvvon sukvvon commented Feb 7, 2026

🎯 Changes

Add a test to verify that remove correctly splices only the target mutation from the scope's internal array when multiple scoped mutations exist.

✅ 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 for mutation removal behavior to ensure targeted removal works correctly when multiple mutations coexist within the same scope.

… mutation from scope with multiple mutations
@changeset-bot
Copy link

changeset-bot bot commented Feb 7, 2026

⚠️ No Changeset found

Latest commit: 5a7fd80

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 7, 2026

📝 Walkthrough

Walkthrough

Adds a new test suite "remove" to the MutationCache test file that verifies targeted removal of mutations within a scoped mutation set, ensuring that removing one mutation only affects the specific mutation and preserves others in the same scope.

Changes

Cohort / File(s) Summary
MutationCache Test Suite
packages/query-core/src/__tests__/mutationCache.test.tsx
Adds "remove" test suite with multiple test cases verifying that removing a mutation only affects the targeted scoped mutation when multiple scoped mutations coexist within the same scope.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

package: query-core

Suggested reviewers

  • TkDodo

Poem

🐰 A test case hops along so bright,
Removing mutations left and right,
One mutation falls, the other stays,
A scoped removal—hip hooray! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the test being added - it verifies the 'remove' method correctly splices a target mutation from a scope when multiple mutations exist, matching the main change in the changeset.
Description check ✅ Passed The description follows the required template with completed sections: Changes section describes the test addition, Checklist items are marked as completed, and Release Impact is properly addressed 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 7, 2026

View your CI Pipeline Execution ↗ for commit 5a7fd80

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

☁️ Nx Cloud last updated this comment at 2026-02-07 07:29:07 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 7, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 5a7fd80

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