Skip to content

test({react,preact}-query/useMutation): add single callback tests for 'mutateAsync'#10488

Merged
sukvvon merged 2 commits intomainfrom
test/react-preact-query-useMutation-mutateAsync-single-callback
Apr 13, 2026
Merged

test({react,preact}-query/useMutation): add single callback tests for 'mutateAsync'#10488
sukvvon merged 2 commits intomainfrom
test/react-preact-query-useMutation-mutateAsync-single-callback

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 13, 2026

🎯 Changes

✅ 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 coverage for asynchronous mutation callbacks in both react-query and preact-query packages.

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 13, 2026

View your CI Pipeline Execution ↗ for commit be99db1

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

☁️ Nx Cloud last updated this comment at 2026-04-13 17:45:33 UTC

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 13, 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: e364d800-bca6-4d8c-abf7-e72c5a949873

📥 Commits

Reviewing files that changed from the base of the PR and between eccac7c and be99db1.

📒 Files selected for processing (2)
  • packages/preact-query/src/__tests__/useMutation.test.tsx
  • packages/react-query/src/__tests__/useMutation.test.tsx

📝 Walkthrough

Walkthrough

Three new test cases added to useMutation tests in both preact-query and react-query packages, validating callback invocation order (onSuccess, onError, onSettled) when using the mutateAsync path. Tests use fake timers to control async execution flow and assert callback sequences. No public API changes.

Changes

Cohort / File(s) Summary
useMutation mutateAsync callback tests
packages/preact-query/src/__tests__/useMutation.test.tsx, packages/react-query/src/__tests__/useMutation.test.tsx
Added three test cases validating mutateAsync callback invocation order: onSuccess after successful completion, onError after failure with per-call error handler, and onSettled after resolution. Tests use fake timers and assert callback execution sequences.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 Hop and test, the callbacks align,
Success, error, settled—all in line,
Async promises kept in their place,
A well-ordered rabbit's embrace!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding single callback tests for mutateAsync in both react-query and preact-query packages.
Description check ✅ Passed The description covers all required sections with appropriate detail: clear bullet points of changes, reference to related work, completed checklist items, and correct release impact marking.

✏️ 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/react-preact-query-useMutation-mutateAsync-single-callback

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

@github-actions
Copy link
Copy Markdown
Contributor

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

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: be99db1

@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 1b661b3 into main Apr 13, 2026
8 checks passed
@sukvvon sukvvon deleted the test/react-preact-query-useMutation-mutateAsync-single-callback branch April 13, 2026 17: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