Skip to content

test(svelte-query): unify queryClient passing to 'setQueryClientContext' and rename test components#10446

Merged
sukvvon merged 2 commits intomainfrom
test/svelte-query-unify-setQueryClientContext
Apr 11, 2026
Merged

test(svelte-query): unify queryClient passing to 'setQueryClientContext' and rename test components#10446
sukvvon merged 2 commits intomainfrom
test/svelte-query-unify-setQueryClientContext

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 11, 2026

🎯 Changes

  • Unify queryClient passing pattern to setQueryClientContext across all svelte-query test components
    • Replace () => queryClient direct passing (5 files: createInfiniteQuery, createQuery, createQueries)
    • Replace ProviderWrapper + multi-file pattern (2 files: useIsFetching, useIsMutating) with single-file setQueryClientContext
    • Remove unused ProviderWrapper.svelte
  • Rename test component files for consistency
    • ChangeClient.svelteChangeClientExample.svelte
    • ParentComponent.svelteBaseExample.svelte
    • ChildComponent.svelteQueryChild.svelte

✅ 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
    • Refactored test infrastructure to use context-based query client setup, replacing prop-based provider patterns.
    • Consolidated test components and removed redundant helper utilities.
    • Updated example tests to directly use TanStack Query APIs for simplified test setup.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 11, 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: 5ac3a0c7-2cac-478c-a56b-26da8fbf718e

📥 Commits

Reviewing files that changed from the base of the PR and between d36ece2 and 0037749.

📒 Files selected for processing (16)
  • packages/svelte-query/tests/ProviderWrapper.svelte
  • packages/svelte-query/tests/QueryClientProvider/BaseExample.svelte
  • packages/svelte-query/tests/QueryClientProvider/QueryChild.svelte
  • packages/svelte-query/tests/QueryClientProvider/QueryClientProvider.svelte.test.ts
  • packages/svelte-query/tests/createInfiniteQuery/BaseExample.svelte
  • packages/svelte-query/tests/createInfiniteQuery/ChangeClientExample.svelte
  • packages/svelte-query/tests/createInfiniteQuery/SelectExample.svelte
  • packages/svelte-query/tests/createInfiniteQuery/createInfiniteQuery.svelte.test.ts
  • packages/svelte-query/tests/createQueries/IsRestoringExample.svelte
  • packages/svelte-query/tests/createQuery/IsRestoringExample.svelte
  • packages/svelte-query/tests/useIsFetching/BaseExample.svelte
  • packages/svelte-query/tests/useIsFetching/FetchStatus.svelte
  • packages/svelte-query/tests/useIsFetching/Query.svelte
  • packages/svelte-query/tests/useIsMutating/BaseExample.svelte
  • packages/svelte-query/tests/useIsMutating/MutatingStatus.svelte
  • packages/svelte-query/tests/useIsMutating/Query.svelte
💤 Files with no reviewable changes (5)
  • packages/svelte-query/tests/useIsFetching/FetchStatus.svelte
  • packages/svelte-query/tests/useIsMutating/MutatingStatus.svelte
  • packages/svelte-query/tests/useIsFetching/Query.svelte
  • packages/svelte-query/tests/ProviderWrapper.svelte
  • packages/svelte-query/tests/useIsMutating/Query.svelte

📝 Walkthrough

Walkthrough

Test examples across svelte-query are refactored from component-wrapper patterns to context-based query client management. Examples now use setQueryClientContext to provide the query client globally, eliminating intermediate wrapper components and simplifying hook invocations by removing explicit queryClient parameters.

Changes

Cohort / File(s) Summary
Deleted test utility components
packages/svelte-query/tests/ProviderWrapper.svelte, packages/svelte-query/tests/useIsFetching/FetchStatus.svelte, packages/svelte-query/tests/useIsFetching/Query.svelte, packages/svelte-query/tests/useIsMutating/MutatingStatus.svelte, packages/svelte-query/tests/useIsMutating/Query.svelte
Removed wrapper and status display components no longer needed with context-based client management.
createInfiniteQuery hook examples
packages/svelte-query/tests/createInfiniteQuery/BaseExample.svelte, packages/svelte-query/tests/createInfiniteQuery/ChangeClientExample.svelte, packages/svelte-query/tests/createInfiniteQuery/SelectExample.svelte, packages/svelte-query/tests/createInfiniteQuery/createInfiniteQuery.svelte.test.ts
Refactored to use setQueryClientContext instead of passing queryClient as second argument; test file updated to render ChangeClientExample.
createQuery and createQueries hook examples
packages/svelte-query/tests/createQuery/IsRestoringExample.svelte, packages/svelte-query/tests/createQueries/IsRestoringExample.svelte
Updated to establish query client via setQueryClientContext, removing explicit queryClient parameters from hook invocations.
QueryClientProvider examples
packages/svelte-query/tests/QueryClientProvider/BaseExample.svelte, packages/svelte-query/tests/QueryClientProvider/QueryClientProvider.svelte.test.ts
Changed child component from ChildComponent to QueryChild; test file updated to render BaseExample.
useIsFetching hook examples
packages/svelte-query/tests/useIsFetching/BaseExample.svelte
Refactored from component composition to direct API usage with setQueryClientContext, inline fetch status display, and simplified query creation.
useIsMutating hook examples
packages/svelte-query/tests/useIsMutating/BaseExample.svelte
Refactored from component composition to direct API usage with setQueryClientContext, inline mutation state display, and streamlined mutation creation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 The context flows where wrappers once did dwell,
No nested props in tangled wrapper's shell—
Sweet setQueryClientContext rings so true,
Test hooks now dance in simpler, cleaner hue!
Clean examples, no more chains to bind,
Just context magic, elegant and refined.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main changes: unifying queryClient passing to setQueryClientContext and renaming test components in svelte-query.
Description check ✅ Passed The description follows the repository template with both required sections completed: detailed changes explaining the unification pattern and component renames, and a checklist with all items properly marked.
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-unify-setQueryClientContext

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 11, 2026

View your CI Pipeline Execution ↗ for commit 0037749

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

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 11, 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 Apr 11, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 11, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 0037749

@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 300d81e into main Apr 11, 2026
8 checks passed
@sukvvon sukvvon deleted the test/svelte-query-unify-setQueryClientContext branch April 11, 2026 04:14
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