Skip to content

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

Merged
sukvvon merged 3 commits intomainfrom
test/svelte-query-createQueries-isRestoring
Apr 5, 2026
Merged

test(svelte-query/createQueries): add test for not fetching when 'isRestoring' is true#10382
sukvvon merged 3 commits intomainfrom
test/svelte-query-createQueries-isRestoring

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 4, 2026

🎯 Changes

  • Add test to verify that createQueries does not fetch queries during the restoring period when isRestoring is true
  • Add IsRestoringExample.svelte component that sets isRestoring context via setIsRestoringContext
  • Matches the existing react-query test pattern for useQueries with IsRestoringProvider

✅ 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 tests and a test component to validate query behavior during a "restoring" period, confirming queries stay pending, show idle fetch state, render no data, and do not invoke fetch functions while restoring. Tests use controlled timers to assert behavior before and after short delays.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 4, 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: 138d35a1-37ca-4d35-bd5b-6204404b7306

📥 Commits

Reviewing files that changed from the base of the PR and between 1bfc560 and 3bc0eb5.

📒 Files selected for processing (2)
  • packages/svelte-query/tests/createQueries/IsRestoringExample.svelte
  • packages/svelte-query/tests/createQueries/createQueries.svelte.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/svelte-query/tests/createQueries/createQueries.svelte.test.ts
  • packages/svelte-query/tests/createQueries/IsRestoringExample.svelte

📝 Walkthrough

Walkthrough

Adds a Svelte test component and a Vitest test that assert createQueries does not start fetching while the global isRestoring context is true.

Changes

Cohort / File(s) Summary
isRestoring behavior tests
packages/svelte-query/tests/createQueries/IsRestoringExample.svelte, packages/svelte-query/tests/createQueries/createQueries.svelte.test.ts
New Svelte test component that sets isRestoring and renders two createQueries results; accompanying test verifies both queries remain pending with fetchStatus: idle, no data, and query functions are not called while restoring.

Sequence Diagram(s)

(omitted — changes are test additions that don't introduce new multi-component runtime control flow)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐇 Hopping through tests with a twitch and a cheer,

Restoring holds tight, no fetch shall appear.
Timers may tick, but the queries stay still,
Quiet and patient upon the testing hill. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a test for the createQueries hook to verify it doesn't fetch during the isRestoring period.
Description check ✅ Passed The description follows the template structure with completed 🎯 Changes and ✅ Checklist sections, clearly explaining what was added and why.
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-createQueries-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 4, 2026

View your CI Pipeline Execution ↗ for commit 3bc0eb5

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

☁️ Nx Cloud last updated this comment at 2026-04-04 07:24:59 UTC

@sukvvon sukvvon self-assigned this Apr 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 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 Apr 4, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 3bc0eb5

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

size-limit report 📦

Path Size
react full 11.98 KB (0%)
react minimal 9.01 KB (0%)

@sukvvon sukvvon marked this pull request as draft April 4, 2026 07:31
@sukvvon sukvvon marked this pull request as ready for review April 5, 2026 05:35
@sukvvon sukvvon merged commit 5f5cfab into main Apr 5, 2026
8 checks passed
@sukvvon sukvvon deleted the test/svelte-query-createQueries-isRestoring branch April 5, 2026 06:04
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