0
Fork 0
mirror of https://github.com/TanStack/query.git synced 2026-11-16 22:50:20 +00:00
Commit graph

2,510 commits

Author SHA1 Message Date
github-actions[bot]
2969edf32f
ci: Version Packages (#11316) 2026-08-28 01:03:02 +09:00
Wonsuk Choi
6c27607d7f
fix(preact-query/useQueries): keep unsubscribed idle (#11315) 2026-08-27 21:02:01 +09:00
github-actions[bot]
2eb3c7c76f
ci: Version Packages (#11313)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-27 17:28:48 +09:00
Wonsuk Choi
67fddee631
fix(preact-query): propagate falsy errors to the error boundary (#11309) 2026-08-27 16:38:51 +09:00
github-actions[bot]
714df67ab1
ci: Version Packages (#11306)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-26 20:32:28 +02:00
alex-js-ltd
ac2b61230e
fix(react-query): propagate falsy errors to the error boundary (#11305)
* test(react-query): cover falsy errors with throwOnError in useQuery

* test(react-query): show falsy errors silently skip the error boundary

* fix(react-query): throw falsy errors from useQueries to the error boundary

* chore: add changeset
2026-08-26 15:27:28 +02:00
github-actions[bot]
1836e61b8c
ci: Version Packages (#11303)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-26 10:56:25 +02:00
Dominik Dorfmeister 🔮
ef1eff1b62
fix(query-devtools): remove solid-js import from declarations (#11300)
* fix(query-devtools): remove solid-js import from declarations

Move public devtools types into a Solid-free module so declaration
generation does not emit a side-effect import for solid-js.

* add integration regression test

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-26 10:50:02 +02:00
Dominik Dorfmeister 🔮
578e5c26e8
ref: bundle-size improvements (#11302)
* ref: bundle-size improvements

* revert size limit for better comparison

* spyOn setInterval
2026-08-26 10:49:36 +02:00
Wonsuk Choi
44645e9eb1
docs(preact-query): rename 'results' to 'postQueries' in 'useSuspenseQueries' example (#11299) 2026-08-26 15:16:52 +09:00
Wonsuk Choi
dbd8fbab49
docs(preact-query): document request-waterfall avoidance across 'useSuspenseQuery' and 'useSuspenseQueries' (#11298)
* docs(preact-query): warn about request waterfalls and point to 'useSuspenseQueries' in 'useSuspenseQuery'

* docs(preact-query): add multiple-parallel-queries example to 'useSuspenseQueries'
2026-08-26 14:52:10 +09:00
Wonsuk Choi
e17de345ce
docs(preact-query): remove redundant 'infiniteQueryOptions' usage from 'useInfiniteQuery' examples (#11297) 2026-08-26 13:59:02 +09:00
Wonsuk Choi
904ab016b0
docs(preact-query): use function declarations instead of arrow functions in example code (#11296) 2026-08-26 13:44:13 +09:00
Wonsuk Choi
f6ed6e4bde
docs(preact-query): expand JSDoc @example coverage across hooks (#11295)
* fix(preact-query): guard 'fetchNextPage' example with 'isFetching', not just 'isFetchingNextPage'

* docs(preact-query): add global loading indicator example to 'useIsFetching'

* docs(preact-query): add mutation-state, 'Promise.all', and 'Promise.allSettled' examples to 'useMutation'

* docs(preact-query): add 'isPending'/'isError' example alongside 'status' to 'useQuery'

* docs(preact-query): fix dependent-query example in 'useQuery' to use 'isLoading' instead of 'isPending'

* docs(preact-query): add pagination example with 'keepPreviousData' to 'useQuery'

* docs(preact-query): correct consecutive-mutation callback wording in 'useMutation' example

* docs(preact-query): add per-call 'onError' callback to basic 'useMutation' example

* docs(preact-query): use contextual message in 'console.error' for 'Promise.all' example in 'useMutation'
2026-08-26 13:31:02 +09:00
github-actions[bot]
51f12db919
ci: Version Packages (#11294)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-25 23:24:07 +02:00
Dominik Dorfmeister 🔮
a05df6aefb
fix(query-core): Avoid scheduling stale timeouts for disabled query observers (#11293)
* fix(query-core): Avoid scheduling stale timeouts for disabled query observers.

* ref: do the cheap thing first
2026-08-25 23:17:25 +02:00
Wonsuk Choi
d09cf1d605
docs(preact-query): backtick bare code-symbol references in JSDoc ('QueryClient', 'suspense', 'throwOnError') (#11290)
* docs(preact-query): wrap bare 'QueryClient' type name in backticks in JSDoc

* docs(preact-query): backtick 'QueryClient' in 'children' prop doc and 'suspense'/'throwOnError' in QueryErrorResetBoundary
2026-08-26 00:14:24 +09:00
Wonsuk Choi
e6503b0990
docs(preact-query): cross-link hooks with their options factories via '@see' and move the infinite-query caveat to '@remarks' (#11289) 2026-08-25 23:28:25 +09:00
Wonsuk Choi
0a16a362dd
docs(preact-query): tag 'subscribed' with '@defaultValue' for structured default-value rendering (#11288) 2026-08-25 23:15:31 +09:00
Wonsuk Choi
84b4f13470
docs(preact-query): document type parameters with '@template' and add 'useQueryClient' throws note (#11285)
* docs(preact-query): document type parameters with '@template' and add 'useQueryClient' throws note

* docs(preact-query): fix TQueryData select direction and TResults/TDepth phrasing flagged by CodeRabbit
2026-08-25 21:28:15 +09:00
Wonsuk Choi
5bb950be80
docs(preact-query): document interfaces and type aliases with JSDoc for generated reference docs (#11284)
* docs(preact-query): document interfaces and type aliases with JSDoc for generated reference docs

* docs(preact-query): fix finite/infinite mix-ups and opaque-array fallback claims flagged by CodeRabbit
2026-08-25 19:35:48 +09:00
Wonsuk Choi
720725d113
docs(preact-query): import 'noop' from '@tanstack/preact-query' instead of '@tanstack/query-core' in examples (#11283) 2026-08-25 17:06:26 +09:00
Wonsuk Choi
870bd854cc
docs(preact-query): document functions and components with JSDoc for generated reference docs (#11204)
* docs(preact-query): document functions and components with JSDoc for generated reference docs

* docs(preact-query): replace concrete API calls with abstract fetcher names in JSDoc examples

* docs(preact-query): rename mutation example fetcher to be CRUD-neutral

* docs(preact-query): rename mutation example fetcher to 'createPosts'

* docs(preact-query): add examples for Suspense, prefetch, and options-builder functions

* docs(preact-query): add optimistic update, dependent query, and SSR hydration examples

* docs(preact-query): add parameterized factory and mutationKey lookup examples to queryOptions/mutationOptions

* docs(preact-query): add infiniteQueryOptions factory example and restore useMutationState's third example

* docs(preact-query): add TkDodo-inspired multi-API reuse, initialData, and per-call mutate callback examples

* docs(preact-query): document useIsRestoring, initialData, mutateAsync, and skipToken-excluded queryFn fields

* docs(preact-query): fill in empty Returns sections for hooks and options builders

* docs(preact-query): systematic sweep of generated pages for missing field descriptions and fix mismatched mutationOptions example

* docs(preact-query): split mutationOptions' mutationKey overload into basic usage and lookup examples

* docs(preact-query): fix overloads whose example didn't match their initialData-required type

* docs(preact-query): fill overloads missing examples and useSuspenseQueries' queryClient param description

* docs(preact-query): remove duplicated overload example and fix examples that failed type-checking

* docs(preact-query): describe every documented parameter and restore reverted overload example

* docs(preact-query): describe children props and low-level context exports

* fix(preact-query): remove inaccurate 'queryFn is optional' claim from infiniteQueryOptions overload

* docs(preact-query): add missing @returns to mutationOptions overloads and provider components

* docs(preact-query): describe QueryErrorResetBoundary children and its render-function parameter

* docs(preact-query): fix prose-accuracy issues found by multi-agent audit

Corrects useQuery's first overload @returns to match its actual return
type, moves the useSuspenseQuery/useSuspenseInfiniteQuery cancellation
caveat out of the @returns block, softens overstated skipToken/queryFn
claims, merges a duplicated useMutationState description, and adds
missing JSDoc to QueryErrorResetBoundary's function-type aliases and
UseMutateFunction/UseMutateAsyncFunction.

* docs(preact-query): soften remaining overstated queryFn requirement in Suspense options

* docs(preact-query): fix inaccurate prose in hydration, queryFn, and useQueries docs

* docs(preact-query): correct hydration freshness gate, placeholderData arity, and deprecated 'fetchInfiniteQuery' reference

* docs(preact-query): remove leftover 'data is never undefined' claim in 'useInfiniteQuery' overload docs

* docs(preact-query): replace deprecated 'prefetchQuery'/'prefetchInfiniteQuery' calls in examples with 'query'/'infiniteQuery'

* docs(preact-query): point 'usePrefetchQuery' JSDoc at 'queryClient.query' to match its actual option type
2026-08-25 16:43:01 +09:00
github-actions[bot]
730b3aa06c
ci: Version Packages (#11276) 2026-08-25 04:21:47 +09:00
Wonsuk Choi
714c2856e0
fix(preact-query/usePrefetchQuery): replace deprecated 'queryClient.fetchQuery' with 'queryClient.query' (#11274)
* fix(preact-query/usePrefetchQuery): replace deprecated 'queryClient.fetchQuery' with 'queryClient.query'

* chore(.changeset): use conventional-commits style wording for changeset entry
2026-08-25 04:06:26 +09:00
Wonsuk Choi
9484a8903e
chore(preact-query): remove eslint-disable comments for rules already off at the package level (#11275) 2026-08-25 04:03:32 +09:00
github-actions[bot]
96f2da6353
ci: Version Packages (#11271)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-24 15:20:40 +02:00
Ben Younes
cafd540c02
fix(svelte-query): handle shrinking createRawRef array by multiple entries (#10341) (#10892)
The `createRawRef` Proxy used by `createQueries` crashed with
`TypeError: 'deleteProperty' on proxy: trap returned falsish for property 'N'`
whenever the reactive query list was shrunk by two or more items in one update.

Two compounding causes:
1. `update()` iterated `keysToRemove` in ascending index order. The trap
   decrements `target.length` after every deletion, so the next stale index
   was no longer `in target` and the trap returned `false`, which throws in
   strict mode (ES modules).
2. The trap returned `false` for missing props instead of treating delete on
   a nonexistent prop as a spec-compliant no-op.

Fix: sort `keysToRemove` descending for arrays so each delete acts on the
current tail, and return `true` from `deleteProperty` when the prop is
already absent.

Generated by Ora Studio
Vibe coded by ousamabenyounes

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-24 15:12:37 +02:00
renechoi
320ed25cac
fix(svelte-query): activate createQueries initialized with an empty array (#11127)
fix(svelte-query): track keys added to an empty createRawRef

createQueries stayed permanently inactive when it was initialized with an
empty queries array. Reads of an absent index have no $state.raw field to
subscribe to, and length is a plain array property, so a consumer that
observed the result while it was empty registered no reactive dependency
and never re-ran once queries were added.

Track those reads through a key version that update() bumps whenever the
key set changes.

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-24 15:03:01 +02:00
alex-js-ltd
250050d863
fix(svelte-query): shrink useMutationState results (#11153)
* test(svelte-query/useMutationState): add coverage for shrinking filtered results

* fix(svelte-query): shrink useMutationState results

* chore: add changeset for useMutationState fix

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-24 14:41:56 +02:00
github-actions[bot]
388bbaf181
ci: Version Packages (#11265)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-23 19:57:36 +02:00
Bart Spaans
80fbf73e77
feat(query-core): export cache config types (#11263)
* export types

* changeset

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-23 19:48:43 +02:00
Dominik Dorfmeister 🔮
f2a5da27fb
chore: update knip (#11262)
* chore: update knip

* ref: move cli options to config options

* fix package lock somehow

* pnpm dedupe
2026-08-23 19:24:11 +02:00
github-actions[bot]
bc423b37ef
ci: Version Packages (#11261)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-23 12:57:01 +02:00
Manuel Schiller
134890dbdc
fix(query-core): accept partial dehydrated state (#11260) 2026-08-23 12:50:28 +02:00
Wonsuk Choi
0fe34b4be3
test(query-core): align mutation test filenames with 'mutation.ts' by renaming and merging duplicate '.test-d' files (#11258) 2026-08-23 12:33:43 +09:00
Wonsuk Choi
be1352b848
test(*): add adapter-level type coverage for optional undefinable mutate variables (#11257) 2026-08-23 12:08:14 +09:00
github-actions[bot]
5743468462
ci: Version Packages (#11206)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-22 20:52:42 +02:00
Định Lê
2215bb0311
fix(query-core): make MutateFunction optional undefinable-variables (#8737)
* feat(query-core): make `MutateFunction` optional undefinable-variables

* test(query-core): MutateFunction

* test(query-core): MutateFunction

* vue

* ci: apply automated fixes

* angular

* fix adapter signatures

* ci: apply automated fixes

* changeset

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-22 11:24:11 +02:00
Manuel Schiller
b4368c4379
perf(query-core): skip no-op hydration callbacks and export dehydrateQuery (#11253)
* perf(query-core): skip no-op hydration callbacks and export dehydrateQuery

* export and add tests

Co-authored-by: Copilot <copilot@github.com>

* stabilize test

---------

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: TkDodo <office@dorfmeister.cc>
2026-08-22 11:13:51 +02:00
Ben Younes
b8517d3173
docs(vue-query): explain why reactive() is needed for result narrowing (#10580)
The type narrowing example wraps useQuery() in reactive() without saying
why, so destructuring the result directly and then checking isSuccess
looks like it should work (#9244). Spell out that reactive() is what
flattens the refs into one discriminated union, and show the
data.value !== undefined check as the alternative when reactive() is not
an option.

Pin both shapes with type tests: the non-reactive result exposes
Ref<T> | Ref<undefined>, and narrowing on data.value refines the ref
itself.

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-22 10:20:36 +02:00
Wonsuk Choi
9fa03e65b6
test(vue-query/useQuery): move suspense regression tests into 'useQuery.test.ts' (#11250) 2026-08-22 12:28:00 +09:00
Wonsuk Choi
eeb9820952
test(vue-query): add regression tests for suspense release on programmatic 'setQueryData' (#11249) 2026-08-22 11:48:04 +09:00
Wonsuk Choi
abd81f4463
test(preact-query/useSuspenseQuery): add regression tests for suspense release on programmatic 'setQueryData' (#11248) 2026-08-22 11:17:06 +09:00
Wonsuk Choi
c9dba0736c
test(query-broadcast-client-experimental): replace inline query key literals with 'queryKey' in incoming message tests (#11247) 2026-08-22 10:48:36 +09:00
Dominik Dorfmeister 🔮
d156adcc15
test: transition tests (#11246)
* test: transition tests

* Apply suggestions from code review

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-21 21:08:04 +02:00
Dominik Dorfmeister 🔮
37127dbe47
fix/11018 (#11245)
* revert: remove NoInfer from useQuery return types

* add union type tests

* changeset
2026-08-21 16:22:28 +02:00
한국
6796c51275
fix(broadcast-client): recover from errors thrown while applying an incoming cross-tab message (#11242)
* fix(broadcast-client): recover from errors thrown while applying an incoming cross-tab message

If applying an incoming cross-tab message (query.setState/queryCache.build,
which notifies observers) throws, the internal `tx()` helper's `transaction`
flag was never reset. This silently disabled all future outgoing broadcasts
from this tab for the rest of the session. Guard with try/finally so a single
failed message can't permanently break cross-tab sync.

* test(broadcast-client): also cover the query.setState throw path

The existing regression test only exercised queryCache.build (a brand-new
remote query hash). Add a case where the incoming message targets an
existing query, so an exception during query.setState is exercised too.

Addresses CodeRabbit review feedback on #11242.
2026-08-21 11:50:13 +02:00
Wonsuk Choi
2fbe04e492
test(query-broadcast-client-experimental): replace inline 'new Promise' timeouts with 'sleep' from 'query-test-utils' (#11241) 2026-08-21 13:56:29 +09:00
Wonsuk Choi
bec1f1b286
test(query-broadcast-client-experimental): replace inline query key literals with 'queryKey' from 'query-test-utils' (#11240) 2026-08-21 13:47:08 +09:00