Ports #9338 to preact-query: ensurePreventErrorBoundaryRetry now
receives the cached query and evaluates a function-form throwOnError
against the actual error before setting retryOnMount = false, instead
of treating any function as truthy. Includes the regression tests
from #9338, two of which fail on current main.
Fixes#11165
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
* chore: tsup -> tsdown
* revert size-limit and fix the build instead
* fix angular and devtools build
* fix nextJs builds
* more solid related things
* fix: import order
* 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>
* test({react,preact}-query/useInfiniteQuery): use the '.then()' convention consistently
* test({react,preact}-query/useMutation): use the '.then()' convention consistently
* test({react,preact}-query/useQueries): use the '.then()' convention consistently
* test({react,preact}-query/useQuery): use the '.then()' convention consistently
* test({react,preact}-query/usePrefetchQuery): inline the 'generateQueryFn' factory into each call site
* test({react,preact}-query/usePrefetchQuery): drop the unnecessary 'vi.fn()' wrapper on the never-asserted sentinel queryFn
* test(*): move 'vi.useRealTimers' to the end of 'afterEach' so cleanup runs under fake timers
* test(*): move 'vi.useRealTimers' to the end of 'afterEach' in persist-client and devtools suites
* test(svelte-query/createQueries): move 'vi.useRealTimers' to the end of 'afterEach'
* fix(query-core): use built-in NoInfer to support generic indexed-access types
The local `NoInfer<T> = [T][T extends any ? 0 : never]` trick breaks down
when `T` is a generic indexed-access type such as `DataTypeToEntity[DT]`,
producing errors like "Type '[DataTypeToEntity[DT]]' is not assignable to
type 'DataTypeToEntity'".
Since the project already requires TypeScript >= 5.4, delegate the public
`NoInfer<T>` alias to TypeScript's built-in `NoInfer` (introduced in 5.4).
A small `noInfer.ts` helper exposes it as `IntrinsicNoInfer<T>` to avoid
the local-shadow recursion problem.
Vue's `setQueryData` implementation now forwards the `<TData>` generic to
`super.setQueryData<TData>(...)` so its declared `NoInfer<TData> | undefined`
return type stays satisfied under the stricter built-in `NoInfer`.
Fixes#9937
* test(react-query): move 'generic indexed access TData' describe out of 'initialData'
Block was nested inside `describe('initialData', ...)` but is unrelated
to initialData behavior. Lift it to sibling level under
`describe('useQuery', ...)` so test output groups it correctly.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test(react-query): document implicit regression guard for generic indexed-access NoInfer
Per CodeRabbit nitpick: clarify that the `getLabel(props.dataType, data)` call
itself is the regression guard. With the previous hand-rolled NoInfer, this
call failed to type-check; with built-in NoInfer (TS 5.4+), it compiles.
An explicit `expectTypeOf(data).toEqualTypeOf<...>()` / `toMatchTypeOf<...>()`
cannot work here — vitest's type-relation checks reduce to
`Extends<NoInfer<T>, T>` which TS leaves unresolved under a generic
`TDataType extends DataType` constraint.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor(query-core): drop NoInfer re-export, use built-in everywhere
Per @TkDodo's review: TypeScript's intrinsic NoInfer (TS ≥ 5.4) is the
canonical type, and the package already requires TS ≥ 5.4. Removing the
re-export sidesteps the self-shadowing issue entirely and avoids
encouraging consumers to import a duplicate.
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>