Skip to content

test(vue-query): replace hardcoded query keys with 'queryKey()' utility#10417

Merged
sukvvon merged 1 commit intomainfrom
test/vue-query-replace-hardcoded-keys-with-queryKey
Apr 7, 2026
Merged

test(vue-query): replace hardcoded query keys with 'queryKey()' utility#10417
sukvvon merged 1 commit intomainfrom
test/vue-query-replace-hardcoded-keys-with-queryKey

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 7, 2026

🎯 Changes

  • Replace hardcoded query/mutation keys with queryKey() utility from @tanstack/query-test-utils across vue-query test files
  • Applied to runtime tests (.test.ts) and type tests (.test-d.ts, .test-d.tsx)
  • Files modified: useQuery.test.ts, useQuery.test-d.ts, useInfiniteQuery.test.ts, useInfiniteQuery.test-d.tsx, useQueries.test.ts, useQueries.test-d.ts, useIsFetching.test.ts, useIsMutating.test.ts, useMutation.test.ts, useMutationState.test.ts, queryOptions.test-d.ts, infiniteQueryOptions.test-d.ts, queryClient.test-d.ts, vueQueryPlugin.test.ts

✅ 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
    • Enhanced test infrastructure across multiple test suites with improved query key generation and handling for more robust type-level and runtime testing.

Note: These are internal testing improvements with no impact on public APIs or end-user functionality.

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 7, 2026

View your CI Pipeline Execution ↗ for commit 9fdf264

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

☁️ Nx Cloud last updated this comment at 2026-04-07 03:10:26 UTC

@github-actions
Copy link
Copy Markdown
Contributor

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

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 9fdf264

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

size-limit report 📦

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 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: b4dba59a-4a6b-48fe-aa21-ebb2cbbdd1a1

📥 Commits

Reviewing files that changed from the base of the PR and between d9384ac and 9fdf264.

📒 Files selected for processing (14)
  • packages/vue-query/src/__tests__/infiniteQueryOptions.test-d.ts
  • packages/vue-query/src/__tests__/queryClient.test-d.ts
  • packages/vue-query/src/__tests__/queryOptions.test-d.ts
  • packages/vue-query/src/__tests__/useInfiniteQuery.test-d.tsx
  • packages/vue-query/src/__tests__/useInfiniteQuery.test.ts
  • packages/vue-query/src/__tests__/useIsFetching.test.ts
  • packages/vue-query/src/__tests__/useIsMutating.test.ts
  • packages/vue-query/src/__tests__/useMutation.test.ts
  • packages/vue-query/src/__tests__/useMutationState.test.ts
  • packages/vue-query/src/__tests__/useQueries.test-d.ts
  • packages/vue-query/src/__tests__/useQueries.test.ts
  • packages/vue-query/src/__tests__/useQuery.test-d.ts
  • packages/vue-query/src/__tests__/useQuery.test.ts
  • packages/vue-query/src/__tests__/vueQueryPlugin.test.ts

📝 Walkthrough

Walkthrough

This PR updates 14 Vue Query test files to generate query and mutation keys dynamically using queryKey() from @tanstack/query-test-utils instead of relying on hardcoded array literals. The changes affect type-level tests and runtime tests across hooks like useQuery, useInfiniteQuery, useMutation, and related utilities.

Changes

Cohort / File(s) Summary
Query Key Type Tests
packages/vue-query/src/__tests__/queryOptions.test-d.ts, packages/vue-query/src/__tests__/useQuery.test-d.ts, packages/vue-query/src/__tests__/useQueries.test-d.ts
Replaced hardcoded queryKey array literals with const key = queryKey() calls; updated type assertions to use the tagged query key variable.
Infinite Query Tests
packages/vue-query/src/__tests__/infiniteQueryOptions.test-d.ts, packages/vue-query/src/__tests__/useInfiniteQuery.test-d.tsx, packages/vue-query/src/__tests__/useInfiniteQuery.test.ts
Switched from static ['key'] or ['infiniteQuery'] to dynamically generated keys; updated QueryClient type assertions with the tagged key.
Query Client Type Tests
packages/vue-query/src/__tests__/queryClient.test-d.ts
Updated fetchInfiniteQuery type tests to use queryKey() instead of hardcoded ['key'].
Mutation Tests
packages/vue-query/src/__tests__/useMutation.test.ts, packages/vue-query/src/__tests__/useMutationState.test.ts, packages/vue-query/src/__tests__/useIsMutating.test.ts
Replaced static mutation/query keys with queryKey()-derived keys; updated reactive filter and ref assignments to align with generated key structures.
Query Filtering Tests
packages/vue-query/src/__tests__/useIsFetching.test.ts
Changed from hardcoded keys (['key1'], ['key2']) to generated keys; updated filter inputs to reference the same generated keys.
Query Hooks Runtime Tests
packages/vue-query/src/__tests__/useQuery.test.ts, packages/vue-query/src/__tests__/useQueries.test.ts
Switched all queryKey values to use queryKey() calls; updated array spreading patterns for getter-based and nested keys; adjusted assertion matchers.
Plugin Integration Tests
packages/vue-query/src/__tests__/vueQueryPlugin.test.ts
Replaced persister and query setup keys with dynamically generated keys via queryKey().

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Keys once carved in stone now hop with grace,
Generated fresh in each test's embrace,
No more hardcoded chains to bind us tight,
Dynamic queries dance into the light!
thump thump

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: replacing hardcoded query keys with the queryKey() utility across vue-query tests.
Description check ✅ Passed The PR description covers the key changes with specific file list and properly marks this as dev-only with no release impact. However, one checklist item indicates the author did not locally test with 'pnpm run test:pr' as required.
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/vue-query-replace-hardcoded-keys-with-queryKey

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

@sukvvon sukvvon self-assigned this Apr 7, 2026
@sukvvon sukvvon merged commit dbe3f95 into main Apr 7, 2026
10 checks passed
@sukvvon sukvvon deleted the test/vue-query-replace-hardcoded-keys-with-queryKey branch April 7, 2026 03:21
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