Skip to content

test(svelte-query/createQuery): add test for not fetching when 'isRestoring' is true#10440

Merged
sukvvon merged 1 commit intomainfrom
test/svelte-query-createQuery-isRestoring
Apr 10, 2026
Merged

test(svelte-query/createQuery): add test for not fetching when 'isRestoring' is true#10440
sukvvon merged 1 commit intomainfrom
test/svelte-query-createQuery-isRestoring

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 10, 2026

🎯 Changes

✅ 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 the isRestoring behavior in query creation.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1bd3b03f-59c8-417e-8c6b-2170dfaa1124

📥 Commits

Reviewing files that changed from the base of the PR and between 125067c and 70b83bf.

📒 Files selected for processing (2)
  • packages/svelte-query/tests/createQuery/IsRestoringExample.svelte
  • packages/svelte-query/tests/createQuery/createQuery.svelte.test.ts

📝 Walkthrough

Walkthrough

This PR introduces test infrastructure for the isRestoring context behavior in svelte-query. It adds a test component and corresponding test suite that verify queries remain idle during restoration periods, ensuring queryFn is not called while isRestoring is active.

Changes

Cohort / File(s) Summary
isRestoring Test Component
packages/svelte-query/tests/createQuery/IsRestoringExample.svelte
New test component that initializes a QueryClient with isRestoring context set to true, creates a query with a provided queryFn, and renders query state (status, fetchStatus, data) for test assertions.
isRestoring Test Suite
packages/svelte-query/tests/createQuery/createQuery.svelte.test.ts
New test file using fake timers to verify that queryFn is not invoked and query state remains pending/idle when isRestoring is active, both immediately and after timer advancement.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

package: svelte-query

Poem

🐰 A rabbit's tale of queries at rest,
When restoring, they take a test,
No fetch calls ring while timers fly,
State stays idle, data shy! 🧪✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: adding a test for createQuery's isRestoring behavior to prevent fetching.
Description check ✅ Passed The description covers all required template sections with clear details about changes, follows the checklist format, and correctly marks the change as dev-only with no release impact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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/svelte-query-createQuery-isRestoring

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 10, 2026

View your CI Pipeline Execution ↗ for commit 70b83bf

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

☁️ Nx Cloud last updated this comment at 2026-04-10 02:33:11 UTC

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

@sukvvon sukvvon self-assigned this Apr 10, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 10, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 70b83bf

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 11.99 KB (0%)
react minimal 9.02 KB (0%)

@sukvvon sukvvon merged commit d45ec4d into main Apr 10, 2026
10 checks passed
@sukvvon sukvvon deleted the test/svelte-query-createQuery-isRestoring branch April 10, 2026 02:54
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.

2 participants