Skip to content

test(*): add adapter-level type coverage for optional undefinable mutate variables - #11257

Merged
sukvvon merged 1 commit into
mainfrom
test/mutate-optional-undefinable-adapter-type-coverage
Aug 23, 2026
Merged

test(*): add adapter-level type coverage for optional undefinable mutate variables#11257
sukvvon merged 1 commit into
mainfrom
test/mutate-optional-undefinable-adapter-type-coverage

Conversation

@sukvvon

@sukvvon sukvvon commented Aug 23, 2026

Copy link
Copy Markdown
Member

🎯 Changes

fix(query-core): make MutateFunction optional undefinable-variables (#8737) made MutateFunction's variables parameter optional when TVariables includes undefined (e.g. number | undefined), and updated the mutate wrapper in every framework adapter (args[0] as TVariables cast) to match. That PR added type-level tests for the conditional type itself in query-core/src/__tests__/mutations.test-d.tsx, but no adapter exposed an equivalent type-level check for its own exported mutate/mutateAsync function (UseMutateFunction, CreateMutateFunction, etc.).

This PR adds one .test-d case per adapter asserting that mutate/mutateAsync can be called with no arguments when TVariables is an optional undefinable type:

  • react-query/src/__tests__/useMutation.test-d.tsx
  • preact-query/src/__tests__/useMutation.test-d.tsx
  • solid-query/src/__tests__/useMutation.test-d.tsx
  • svelte-query/tests/createMutation/createMutation.test-d.ts
  • angular-query-experimental/src/__tests__/inject-mutation.test-d.ts
  • vue-query/src/__tests__/useMutation.test-d.tsx

✅ 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).

@sukvvon sukvvon self-assigned this Aug 23, 2026
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dbce7d1d-3065-4e37-bcf2-436d924083ed

📥 Commits

Reviewing files that changed from the base of the PR and between 40321a0 and d9f30fe.

📒 Files selected for processing (6)
  • packages/angular-query-experimental/src/__tests__/inject-mutation.test-d.ts
  • packages/preact-query/src/__tests__/useMutation.test-d.tsx
  • packages/react-query/src/__tests__/useMutation.test-d.tsx
  • packages/solid-query/src/__tests__/useMutation.test-d.tsx
  • packages/svelte-query/tests/createMutation/createMutation.test-d.ts
  • packages/vue-query/src/__tests__/useMutation.test-d.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The pull request adds type-level coverage across Angular, Preact, React, Solid, Svelte, and Vue mutation APIs. The tests verify that mutate and mutateAsync accept no arguments when mutation variables include undefined.

Changes

Mutation callability coverage

Layer / File(s) Summary
Cross-framework mutation type tests
packages/*-query*/...useMutation.test-d.ts*, packages/svelte-query/tests/createMutation/createMutation.test-d.ts
Added type-level tests for argumentless mutate and mutateAsync calls with number | undefined mutation variables.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to d9f30

This change adds type coverage for optional mutation variables without changing published runtime behavior. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the adapter-level type coverage added for optional undefinable mutate variables.
Description check ✅ Passed The description explains the change, lists affected adapters, and completes the checklist and release-impact sections.
✨ 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/mutate-optional-undefinable-adapter-type-coverage

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@nx-cloud

nx-cloud Bot commented Aug 23, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit d9f30fe

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

☁️ Nx Cloud last updated this comment at 2026-08-23 03:07:25 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

pkg-pr-new Bot commented Aug 23, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@11257

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: d9f30fe

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

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

@sukvvon
sukvvon merged commit be1352b into main Aug 23, 2026
9 checks passed
@sukvvon
sukvvon deleted the test/mutate-optional-undefinable-adapter-type-coverage branch August 23, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant