0
Fork 0
mirror of https://github.com/TanStack/query.git synced 2026-11-18 19:33:22 +00:00
query/packages/solid-query
Zelys 6e3d521fe5
fix(types): propagate generic type params to useMutationState select callback (#10373)
* fix(types): propagate generic type params to useMutationState select callback

When TResult is a typed MutationState, the select callback parameter
now receives the correctly typed Mutation instead of the base Mutation type.

Adds a second type param TMutation (defaulting to MutationTypeFromResult<TResult>)
to MutationStateOptions across all five framework adapters. Uses a non-distributive
conditional type to avoid union expansion when TResult is unresolved.

Fixes #9825

* ci: apply automated fixes

* refactor(types): simplify useMutationState cast to mutation as TMutation

Replace the double-cast `(fn as unknown as (m: Mutation) => TResult)(m)`
with the direct `fn(m as TMutation)` across all five framework packages.

The constraint `TMutation extends Mutation<any, any, any, any>` creates
sufficient overlap for the single cast to compile cleanly on TS 5.4–6.0.

* fix(test): reorder imports in useMutationState.test-d.tsx per import/order rule

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(svelte-query): eliminate duplicate MutationTypeFromResult definition

Export MutationTypeFromResult from types.ts so useMutationState.svelte.ts
can import it instead of redefining it. Also normalises the else branch to
plain Mutation, matching every other adapter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
History 2026-08-18 10:02:05 +02:00
..
src fix(types): propagate generic type params to useMutationState select callback (#10373) 2026-08-18 10:02:05 +02:00
CHANGELOG.md ci: Version Packages (#11094) 2026-07-21 15:00:30 +02:00
eslint.config.js ci(*): update vitest/expect-expect rule as error (#9111) 2025-05-07 03:21:51 +09:00
package.json chore: update to ts 7 and move cut-off to 5.6 (#11212) 2026-08-17 22:50:18 +02:00
README.md docs: use the dynamic README header endpoint (#11136) 2026-08-03 13:43:19 +02:00
root.eslint.config.js chore: composite monorepo (#8560) 2025-01-27 15:58:10 +01:00
test-setup.ts chore: Disable vitest globals (#6216) 2023-10-22 12:08:22 +11:00
tsconfig.json chore(tsconfig.json): narrow 'include' pattern to prevent TS6053 race conditions from tsup bundled config files (#10522) 2026-05-04 03:24:13 +09:00
tsconfig.legacy.json chore: composite monorepo (#8560) 2025-01-27 15:58:10 +01:00
tsconfig.prod.json fix/nodejs timeout (#10325) 2026-03-23 15:58:17 +01:00
tsup.config.ts chore: update to ts 7 and move cut-off to 5.6 (#11212) 2026-08-17 22:50:18 +02:00
vite.config.ts fix(tests): disable local coverage instrumentation (#10776) 2026-05-26 17:29:33 +02:00

TanStack Solid Query

Hooks for fetching, caching and updating asynchronous data in Solid

#TanStack semantic-release Join the discussion on Github Best of JS Gitpod Ready-to-Code

Enjoy this library? Try the entire TanStack! TanStack Table, TanStack Router, TanStack Virtual

Visit tanstack.com/query for docs, guides, API and more!

Quick Features

  • Transport/protocol/backend agnostic data fetching (REST, GraphQL, promises, whatever!)
  • Auto Caching + Refetching (stale-while-revalidate, Window Refocus, Polling/Realtime)
  • Parallel + Dependent Queries
  • Mutations + Reactive Query Refetching
  • Multi-layer Cache + Automatic Garbage Collection
  • Paginated + Cursor-based Queries
  • Load-More + Infinite Scroll Queries w/ Scroll Recovery
  • Request Cancellation
  • Suspense + Fetch-As-You-Render Query Prefetching
  • Dedicated Devtools

Become a Sponsor!