Skip to content

test(svelte-query): replace hardcoded query keys with 'queryKey()' in Svelte test components#10443

Merged
sukvvon merged 1 commit intomainfrom
test/svelte-query-replace-hardcoded-keys-in-svelte-components
Apr 10, 2026
Merged

test(svelte-query): replace hardcoded query keys with 'queryKey()' in Svelte test components#10443
sukvvon merged 1 commit intomainfrom
test/svelte-query-replace-hardcoded-keys-in-svelte-components

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 10, 2026

🎯 Changes

  • Replace hardcoded query/mutation keys with queryKey() utility in Svelte test component files (.svelte)
  • Applied to createQueries/IsRestoringExample.svelte, createInfiniteQuery/BaseExample.svelte, createInfiniteQuery/SelectExample.svelte, createQuery/IsRestoringExample.svelte, useIsFetching/Query.svelte, useIsMutating/Query.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
    • Updated test query key configurations to use centralized key generation across multiple test examples.

@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: 75719814-dbdb-407c-b51a-53ac9bb0a436

📥 Commits

Reviewing files that changed from the base of the PR and between 5048e86 and 03dc2af.

📒 Files selected for processing (6)
  • packages/svelte-query/tests/createInfiniteQuery/BaseExample.svelte
  • packages/svelte-query/tests/createInfiniteQuery/SelectExample.svelte
  • packages/svelte-query/tests/createQueries/IsRestoringExample.svelte
  • packages/svelte-query/tests/createQuery/IsRestoringExample.svelte
  • packages/svelte-query/tests/useIsFetching/Query.svelte
  • packages/svelte-query/tests/useIsMutating/Query.svelte

📝 Walkthrough

Walkthrough

Multiple test example files in the svelte-query package have been updated to replace hardcoded query and mutation key literals with dynamically generated keys using the queryKey() helper function imported from @tanstack/query-test-utils.

Changes

Cohort / File(s) Summary
Infinite Query Tests
packages/svelte-query/tests/createInfiniteQuery/BaseExample.svelte, packages/svelte-query/tests/createInfiniteQuery/SelectExample.svelte
Replaced static queryKey: ['test'] with queryKey() helper; adjusted imports to include queryKey from test utilities.
Query Hook Tests
packages/svelte-query/tests/createQueries/IsRestoringExample.svelte, packages/svelte-query/tests/createQuery/IsRestoringExample.svelte, packages/svelte-query/tests/useIsFetching/Query.svelte
Updated query key generation from hardcoded array literals (['restoring-1'], ['restoring-2'], ['test']) to dynamic queryKey() calls; added necessary imports.
Mutation Hook Test
packages/svelte-query/tests/useIsMutating/Query.svelte
Changed mutation key from fixed ['mutation-1'] array to queryKey() generated value; updated imports accordingly.

Possibly related PRs

  • #10416: Identical pattern of replacing hardcoded query/mutation key literals with queryKey() helper in solid-query test files.
  • #10425: Same code-level change replacing static key arrays with queryKey() test utility across multiple test files.
  • #10415: Related svelte-query test updates using the same queryKey() helper migration pattern.

Suggested labels

package: svelte-query

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Keys that were rigid, now dance and sway,
Generated fresh each testing day,
The queryKey() helper hops our way,
Test examples shimmer in a better way! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly summarizes the main change: replacing hardcoded query keys with the queryKey() utility in Svelte test components, which accurately reflects the modifications across all six updated files.
Description check ✅ Passed The pull request description follows the template with completed sections for Changes and Release Impact, includes all six modified files, and indicates dev-only changes. However, one checklist item remains unchecked.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/svelte-query-replace-hardcoded-keys-in-svelte-components

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 03dc2af

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

☁️ Nx Cloud last updated this comment at 2026-04-10 06:05:29 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.

@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@10443

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 03dc2af

@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 self-assigned this Apr 10, 2026
@sukvvon sukvvon merged commit d36ece2 into main Apr 10, 2026
10 checks passed
@sukvvon sukvvon deleted the test/svelte-query-replace-hardcoded-keys-in-svelte-components branch April 10, 2026 06: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.

1 participant