Skip to content

test(query-persist-client-core/createPersister): add test for 'retrieveQuery' returning data without a restore callback#10883

Merged
sukvvon merged 1 commit into
mainfrom
test/query-persist-client-core-retrieve-query-without-callback
Jun 4, 2026
Merged

test(query-persist-client-core/createPersister): add test for 'retrieveQuery' returning data without a restore callback#10883
sukvvon merged 1 commit into
mainfrom
test/query-persist-client-core-retrieve-query-without-callback

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Jun 4, 2026

🎯 Changes

Adds a unit test for retrieveQuery, which is part of the persister's public API but was previously only exercised indirectly through persisterFn. Calling it directly without a restore callback returns the persisted data, covering the branch where no after-restore callback is scheduled.

✅ 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 query retrieval functionality to verify that previously persisted query data is correctly returned.

…veQuery' returning data without a restore callback
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 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: b65c27c3-1c60-4388-aa1b-a5185f761615

📥 Commits

Reviewing files that changed from the base of the PR and between c4b39ff and fc2afcb.

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

📝 Walkthrough

Walkthrough

This PR adds a test suite for the retrieveQuery method in the query persist client. The new test case persists query data to storage and verifies that persister.retrieveQuery(queryHash) returns the stored cache data when called without a restore callback.

Changes

Query Retrieval Test Coverage

Layer / File(s) Summary
retrieveQuery test case
packages/query-persist-client-core/src/__tests__/createPersister.test.ts
New retrieveQuery test suite with a case that persists query data via persistQueryByKey, then calls persister.retrieveQuery(queryHash) and asserts the returned value matches the stored cache data.

Estimated Code Review Effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

A fluffy tester hops with glee,
Adding tests so code runs free,
Query data persists with care,
Retrieved again, it's always there! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the primary change: adding a test for the 'retrieveQuery' function behavior without a restore callback.
Description check ✅ Passed The description follows the required template with all sections completed: Changes section explains the test addition and its purpose, Checklist confirms both required items are checked, and Release Impact correctly identifies this 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-retrieve-query-without-callback

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Jun 4, 2026

View your CI Pipeline Execution ↗ for commit fc2afcb

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

☁️ Nx Cloud last updated this comment at 2026-06-04 06:17:01 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

🚀 Changeset Version Preview

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

@sukvvon sukvvon self-assigned this Jun 4, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 4, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: fc2afcb

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

size-limit report 📦

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

@sukvvon sukvvon merged commit c2d73d5 into main Jun 4, 2026
9 checks passed
@sukvvon sukvvon deleted the test/query-persist-client-core-retrieve-query-without-callback branch June 4, 2026 06:29
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