Skip to content

test(lit-query/createMutationController): add test for not applying updates from the previous client mutation after switching clients - #11805

Merged
sukvvon merged 5 commits into
mainfrom
test/lit-query-create-mutation-controller-previous-client-mutation
Oct 3, 2026
Merged

sukvvon merged 5 commits into
mainfrom
test/lit-query-create-mutation-controller-previous-client-mutation

Conversation

@sukvvon

@sukvvon sukvvon commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

🎯 Changes

Adds "should not apply updates from the previous client mutation after switching clients" to createMutationController tests. A mutation is started on the provider's first client, and the provider switches to another client while it is pending. It asserts that the rendered status becomes idle after the switch and stays idle after the previous mutation settles.

The existing client switch test did not have a mutation in flight, so none checked that the previous client's mutation observer stops updating the controller.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I have followed the AI contribution policy and fully understand the code in this pull request, including any code generated with AI assistance.

🚀 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 coverage for changing provider clients while a mutation is pending. The rendered mutation state returns to idle after the switch and remains idle when the original mutation completes, confirming that a pending operation from the previous client does not change the displayed state.

…pdates from the previous client mutation after switching clients
@sukvvon sukvvon self-assigned this Oct 2, 2026
@nx-cloud

nx-cloud Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 3ff5378

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

☁️ Nx Cloud last updated this comment at 2026-10-03 07:25:03 UTC

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: TanStack/query/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a5a22e39-1389-4612-b764-e92dc5bd65c9
📥 Commits

Reviewing files that changed from the base of the PR and between ca56e62 and 3ff5378.

📒 Files selected for processing (1)
  • packages/lit-query/src/__tests__/createMutationController.test.ts
 ______________________________________________________________
< Ad Astra Per Codicem Fixis. To the stars through code fixes. >
 --------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: TanStack/query/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5b4a992d-daba-49df-959c-a4581eaafb03
📥 Commits

Reviewing files that changed from the base of the PR and between f2bbd81 and ca56e62.

📒 Files selected for processing (1)
  • packages/lit-query/src/__tests__/createMutationController.test.ts
💤 Files with no reviewable changes (1)
  • packages/lit-query/src/tests/createMutationController.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Adds a test that switches the provider’s QueryClient while a mutation is pending. The test checks that the consumer’s status is idle after the switch and remains idle when the mutation started with the previous client completes.

Changes

Mutation client switch behavior

Layer / File(s) Summary
Verify status after client switch
packages/lit-query/src/__tests__/createMutationController.test.ts
The test switches from client A to client B while a mutation is pending. It checks that the consumer reports idle after the switch and after the original mutation completes.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to ca56e

The new test covers the pending-mutation client switch through settlement. No issue has been established that would prevent merging.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the added regression test and the client-switching mutation behavior it covers.
Description check ✅ Passed The description includes all template sections, explains the test and its motivation, and completes the checklist and release-impact selection.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@pkg-pr-new

pkg-pr-new Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@11805

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: ca56e62

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 11.73 KB (0%)
react minimal 8.58 KB (0%)

@changeset-bot

changeset-bot Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3ff5378

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

@sukvvon
sukvvon merged commit 1182a06 into main Oct 3, 2026
7 of 8 checks passed
@sukvvon
sukvvon deleted the test/lit-query-create-mutation-controller-previous-client-mutation branch October 3, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant