Skip to content

test({react,preact}-query/useMutation): add parallel 'mutateAsync' tests with 'Promise.all' and 'Promise.allSettled'#10493

Merged
sukvvon merged 2 commits intomainfrom
test/useMutation-parallel-mutateAsync
Apr 14, 2026
Merged

test({react,preact}-query/useMutation): add parallel 'mutateAsync' tests with 'Promise.all' and 'Promise.allSettled'#10493
sukvvon merged 2 commits intomainfrom
test/useMutation-parallel-mutateAsync

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 14, 2026

🎯 Changes

Add 3 parallel mutateAsync tests to both react-query and preact-query:

  • Promise.all with all successful parallel calls
  • Promise.all rejection when one parallel call fails (try/catch)
  • Promise.allSettled with partial failure handling

✅ 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 concurrent mutation handling in both Preact Query and React Query packages.
    • Added test cases verifying successful parallel mutation execution and result aggregation.
    • Added test cases for error handling in concurrent operations.
    • Added test cases for partial failure scenarios with mixed success and error outcomes.

…sts with 'Promise.all' and 'Promise.allSettled'
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 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: 4a16e7d8-1944-4949-a3ea-9af31f750ab1

📥 Commits

Reviewing files that changed from the base of the PR and between d7643b5 and 1dcab8d.

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

📝 Walkthrough

Walkthrough

Added three new test cases each to the preact-query and react-query useMutation test files, verifying concurrent mutateAsync behavior including successful parallel execution with Promise.all, rejection handling with Promise.all, and partial failure scenarios with Promise.allSettled.

Changes

Cohort / File(s) Summary
Concurrent Mutation Tests
packages/preact-query/src/__tests__/useMutation.test.tsx, packages/react-query/src/__tests__/useMutation.test.tsx
Added three new test cases verifying concurrent mutateAsync invocation: (1) successful parallel mutations aggregated with Promise.all, (2) error handling when one mutation rejects within Promise.all, and (3) partial failure handling using Promise.allSettled with result/error mapping.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Three tests hop side by side,
Mutations race—with none to hide!
Promise.all, allSettled too,
Concurrent dreams all tested true!

🚥 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 pull request title clearly summarizes the main change: adding parallel mutateAsync tests with Promise.all and Promise.allSettled to both react-query and preact-query packages.
Description check ✅ Passed The description includes all required template sections with meaningful content: Changes section describes the three test cases, Checklist items are marked appropriately, and Release Impact correctly identifies this as dev-only with no changeset needed.

✏️ 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/useMutation-parallel-mutateAsync

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 14, 2026

View your CI Pipeline Execution ↗ for commit 1dcab8d

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

☁️ Nx Cloud last updated this comment at 2026-04-14 00:56:46 UTC

@github-actions
Copy link
Copy Markdown
Contributor

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

pkg-pr-new bot commented Apr 14, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 1dcab8d

@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 aad1bd5 into main Apr 14, 2026
8 checks passed
@sukvvon sukvvon deleted the test/useMutation-parallel-mutateAsync branch April 14, 2026 01:04
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