Skip to content

test(svelte-query/useMutationState): add test for 'select' option in 'useMutationState'#10150

Open
sukvvon wants to merge 1 commit intoTanStack:mainfrom
sukvvon:test/svelte-query-useMutationState-select
Open

test(svelte-query/useMutationState): add test for 'select' option in 'useMutationState'#10150
sukvvon wants to merge 1 commit intoTanStack:mainfrom
sukvvon:test/svelte-query-useMutationState-select

Conversation

@sukvvon
Copy link
Contributor

@sukvvon sukvvon commented Feb 18, 2026

🎯 Changes

Add a test for the select option in useMutationState, covering the truthy branch of the options.select ternary (options.select ? options.select(mutation) : mutation.state).

Existing tests only called useMutationState without select, leaving the options.select(mutation) path uncovered.

The new test verifies that select: (mutation) => mutation.state.status correctly extracts mutation status values ("pending""success").

✅ 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
    • Added comprehensive test coverage for mutation state selection functionality, validating state transitions through mutation lifecycle stages.

@changeset-bot
Copy link

changeset-bot bot commented Feb 18, 2026

⚠️ No Changeset found

Latest commit: 90e3a2f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 18, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

A new test component SelectExample.svelte is introduced to the svelte-query package, along with a corresponding test case in useMutationState.svelte.test.ts that validates the mutation state selection functionality by verifying variable state transitions through mutation lifecycle stages.

Changes

Cohort / File(s) Summary
Test Component
packages/svelte-query/tests/useMutationState/SelectExample.svelte
New Svelte component that instantiates a QueryClient, creates a mutation, and uses useMutationState to track and display mutation variables.
Test Suite
packages/svelte-query/tests/useMutationState/useMutationState.svelte.test.ts
Added test case "should return selected value when using select option" that verifies mutation state selection across lifecycle states (initial, pending, success). Note: Test appears to be duplicated in the file.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

package: svelte-query

Poem

🐰 A mutation test hops into view,
SelectExample shows what's new—
State transitions, clean and neat,
Variables tracked from start to beat! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a test for the 'select' option in 'useMutationState', which aligns with the changeset that introduces a new test covering previously untested code paths.
Description check ✅ Passed The description includes all required template sections: detailed explanation of changes, completed checklist items, and proper release impact designation as docs/CI/dev-only.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@nx-cloud
Copy link

nx-cloud bot commented Feb 18, 2026

View your CI Pipeline Execution ↗ for commit 90e3a2f

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

☁️ Nx Cloud last updated this comment at 2026-02-18 09:55:57 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 18, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 90e3a2f

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

Comments