Skip to content

Comments

test(solid-query/useQuery): add test for 'isRestoring' transition from true to false triggering refetch#10168

Open
sukvvon wants to merge 2 commits intoTanStack:mainfrom
sukvvon:test/solid-query-useBaseQuery-isRestoring
Open

test(solid-query/useQuery): add test for 'isRestoring' transition from true to false triggering refetch#10168
sukvvon wants to merge 2 commits intoTanStack:mainfrom
sukvvon:test/solid-query-useBaseQuery-isRestoring

Conversation

@sukvvon
Copy link
Contributor

@sukvvon sukvvon commented Feb 22, 2026

🎯 Changes

Add a test to cover the isRestoring signal transition (truefalse) triggering a refetch in useBaseQuery.ts (lines 338-339).

The test verifies that:

  • While isRestoring is true, the query stays in pending status with idle fetchStatus and does not call queryFn
  • When isRestoring transitions to false, the query refetches and resolves to success

This mirrors the behavior of PersistQueryClientProvider in solid-query-persist-client (src/PersistQueryClientProvider.tsx:20,33).

✅ 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

  • New Features

    • Added a new public API export for managing restoration state in queries.
  • Tests

    • Added tests ensuring queries respect restoration state: no fetching during restoration, automatic refetch upon completion.

@changeset-bot
Copy link

changeset-bot bot commented Feb 22, 2026

⚠️ No Changeset found

Latest commit: 8e8b776

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

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

A new IsRestoringProvider export is added to the public API, and test cases are introduced in useQuery tests to verify that queries do not fetch during restoration and refetch after restoration completes.

Changes

Cohort / File(s) Summary
Public API Export
packages/solid-query/src/ (index/exports)
New public export IsRestoringProvider added to the solid-query public API.
useQuery Restoration Tests
packages/solid-query/src/__tests__/useQuery.test.tsx
Adds test cases (duplicated in two locations) verifying that useQuery suppresses fetch operations during restoration state and triggers a refetch once restoration completes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • manudeli
  • TkDodo

Poem

🐰 A provider hops into sight,
To test the queries through restoration's night,
No fetch while restoring, that's the way,
Then refetch when restoration's done—hooray! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a test for the 'isRestoring' transition triggering a refetch in useQuery.
Description check ✅ Passed The description follows the template structure, includes detailed explanation of test coverage, confirms checklist items, and correctly marks this as dev-only with no changeset needed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 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 22, 2026

View your CI Pipeline Execution ↗ for commit 8e8b776

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

☁️ Nx Cloud last updated this comment at 2026-02-22 14:06:56 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 22, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 8e8b776

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