Skip to content

test(query-persist-client-core/retryStrategies): add test for 'removeOldestQuery' preserving mutations#10869

Merged
sukvvon merged 1 commit into
mainfrom
test/query-persist-client-core-remove-oldest-query-mutations
Jun 3, 2026
Merged

test(query-persist-client-core/retryStrategies): add test for 'removeOldestQuery' preserving mutations#10869
sukvvon merged 1 commit into
mainfrom
test/query-persist-client-core-remove-oldest-query-mutations

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Jun 3, 2026

🎯 Changes

Adds a unit test for removeOldestQuery verifying that it only removes queries and leaves the persisted mutations untouched.

✅ 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
    • Enhanced test coverage for query persistence to verify that mutations remain preserved when removing older persisted queries.

@sukvvon sukvvon self-assigned this Jun 3, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c313fa0e-e686-49b5-b53b-f2b19fb673a5

📥 Commits

Reviewing files that changed from the base of the PR and between b6b9d1a and e86e1d5.

📒 Files selected for processing (1)
  • packages/query-persist-client-core/src/__tests__/retryStrategies.test.ts

📝 Walkthrough

Walkthrough

A new test case is added to verify that when removeOldestQuery removes the oldest query from a persisted client, any mutations stored in clientState.mutations are preserved and unaffected.

Changes

Test Coverage for Query Removal

Layer / File(s) Summary
Test: removeOldestQuery mutation preservation
packages/query-persist-client-core/src/__tests__/retryStrategies.test.ts
Dehydrates a mutation, injects it into a persisted client alongside a query, calls removeOldestQuery, and asserts that the oldest query is removed while clientState.mutations remains unchanged.

Possibly related PRs

  • TanStack/query#10867: Adds a Vitest case for removeOldestQuery in the same test file to verify persisted mutations are preserved.
  • TanStack/query#10868: Extends Vitest coverage for removeOldestQuery behavior in retryStrategies.test.ts with additional assertions.

Poem

🐰 A query grows old and must retire with grace,
But mutations stay safe in their special place,
The test ensures this with careful care,
That data persists through the removal fair! ✨

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: adding a test for 'removeOldestQuery' that verifies mutations are preserved.
Description check ✅ Passed The description follows the required template with all sections completed: Changes section explains the test addition, Checklist items are marked as completed, and Release Impact correctly indicates this is docs/CI/dev-only with no changeset needed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ 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/query-persist-client-core-remove-oldest-query-mutations

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Jun 3, 2026

View your CI Pipeline Execution ↗ for commit e86e1d5

Command Status Duration Result
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1m 4s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-03 15:24:44 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

🚀 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 Jun 3, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: e86e1d5

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

size-limit report 📦

Path Size
react full 12.11 KB (0%)
react minimal 9.08 KB (0%)

@sukvvon sukvvon merged commit 8f6f923 into main Jun 3, 2026
11 of 12 checks passed
@sukvvon sukvvon deleted the test/query-persist-client-core-remove-oldest-query-mutations branch June 3, 2026 15:30
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