Skip to content

test(query-persist-client-core/retryStrategies): add test for 'removeOldestQuery' returning undefined when there are no queries#10868

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

test(query-persist-client-core/retryStrategies): add test for 'removeOldestQuery' returning undefined when there are no queries#10868
sukvvon merged 1 commit into
mainfrom
test/query-persist-client-core-remove-oldest-query-empty

Conversation

@sukvvon

@sukvvon sukvvon commented Jun 3, 2026

Copy link
Copy Markdown
Member

🎯 Changes

Adds a unit test for removeOldestQuery covering the case where the persisted client has no queries to remove: it returns undefined, which signals the persister to stop retrying instead of looping forever.

✅ 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 removeOldestQuery function behavior when no queries are present.

…OldestQuery' returning undefined when there are no queries
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

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: b546b9bc-9ddb-4e71-88cf-f87299209f55

📥 Commits

Reviewing files that changed from the base of the PR and between 64b54a0 and baa2326.

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

📝 Walkthrough

Walkthrough

This PR adds a single test case to verify that the removeOldestQuery function returns undefined when a persisted client contains no queries, extending test coverage for an edge case in the retry strategies module.

Changes

removeOldestQuery empty queries test coverage

Layer / File(s) Summary
Test for removeOldestQuery with empty queries
packages/query-persist-client-core/src/__tests__/retryStrategies.test.ts
New vitest test case asserts that removeOldestQuery returns undefined when the persisted client is initialized with an empty queries array.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • TanStack/query#10867: Adds additional Vitest coverage for removeOldestQuery in the same test file, testing oldest and tie-removal behavior.

Poem

🐰 A test so small, yet vital still,
When queries flee and caches spill,
Empty returns with graceful ease,
undefined flows like gentle breeze,
Edge cases covered, all is well! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the test addition: verifying that 'removeOldestQuery' returns undefined when there are no queries, which directly matches the changeset's primary focus.
Description check ✅ Passed The description follows the template structure with all required sections completed: detailed 'Changes' explaining the test's purpose, fully checked checklist items, and release impact correctly marked as docs/CI/dev-only.
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-empty

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

@sukvvon sukvvon self-assigned this Jun 3, 2026
@nx-cloud

nx-cloud Bot commented Jun 3, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit baa2326

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 1m 21s View ↗

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

@github-actions

github-actions Bot commented Jun 3, 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.

@pkg-pr-new

pkg-pr-new Bot commented Jun 3, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: baa2326

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

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

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