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

1,179 commits

Author SHA1 Message Date
Ciarán Curley
40321a0b1b
docs: add docs for simplified query methods (#10662)
docs: add docs for simplfied impertive query methods

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-22 21:04:36 +02:00
Davyd NRB
5ca904d068
Enhance DevTools support with Rozenite Plugin (#10328)
Updated the DevTools support section to include the Rozenite Plugin for React Native DevTools users, enhancing the available debugging options.
2026-08-22 10:28:39 +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
Ciarán Curley
e6748265c8
React: update usePrefetchQuery to use new methods, plus react adaptor tests and docs (#10668)
* feat(react-query): update usePrefetchQuery to use new imperitive methods plus tests

* docs(react-query): new docs for usePrefetchQuery

* Update .changeset/warm-candies-like.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update packages/react-query/src/usePrefetchInfiniteQuery.tsx

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>

* Update packages/react-query/src/usePrefetchQuery.tsx

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-20 18:35:32 +02:00
Ciarán Curley
4e48c581b7
Preact: update usePrefetchQuery to use new methods with docs (#10669)
* feat(preact-query): use new methods for usePrefetchQuery plus tests

* docs(preact-query): updated docs for usePrefetchQuery

* Update docs/framework/preact/reference/interfaces/UsePrefetchInfiniteQueryOptions.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update packages/preact-query/src/usePrefetchInfiniteQuery.tsx

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>

* Update packages/preact-query/src/usePrefetchQuery.tsx

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-20 18:35:10 +02:00
Ciarán Curley
97ce30b51e
Vue: add new impertive methods to vue proxy QueryClient (#11208)
* feat(vue-query): add new methods to vue-query

* docs(vue-query): docs for new impertive methods for Vue

* fix(vue-query): remove getter options from impertive methods

There is no evidence that the () => queryOptions getter type is
properly used by `fetchQuery` et al, as while it accepts a getter in the
types, it doens't resolve the function at runtime (as opposed to
`useQuery`). Removing the type from `query` and `fetchQuery` and
documenting calling getters impertivly as a workaround.

* Update packages/vue-query/src/queryClient.ts

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>

* Update packages/vue-query/src/usePrefetchQuery.ts

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-20 17:12:42 +02:00
Dominik Dorfmeister 🔮
1ef42087c9
ref: remove experimental_prefetchInRender (#11221) 2026-08-20 11:32:10 +02:00
Dominik Dorfmeister 🔮
bf7ae20fed
docs(example): batching (#11008)
* docs(example): dataloader

* use tanstack pacer instead of dataloader

* add staleTime

* switch to useAsyncBatchedCallback

* Revert "switch to useAsyncBatchedCallback"

This reverts commit 4d408daa63.

* fix: use PromiseWithResolvers

* add batching example to docs
2026-08-20 11:25:31 +02:00
rejifald
ee4c7c2be3
docs: add StitchAPI to community resources (#11025)
* docs: add StitchAPI to community resources

* docs: reframe StitchAPI entry as a queryFn complement, not a competitor
2026-08-20 11:13:07 +02:00
n-satoshi061
3c79861ab1
fix(broadcast-client): handle unhandled postMessage rejections (#10771)
* fix(broadcast-client): handle unhandled postMessage rejections

Wrap channel.postMessage() calls in safePost() to catch DataCloneError
and similar failures that occur when query data contains non-cloneable
values (ReadableStream, Response, Vue reactive proxies, etc.).

Adds an optional onBroadcastError callback to BroadcastQueryClientOptions
so consumers can pipe errors to Sentry/Datadog. Falls back to console.warn
in development when the callback is not provided.

Fixes #10543

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

* fix(broadcast-client): guard against throwing onBroadcastError callback

Wrap onBroadcastError() in a try/catch so that if the callback itself
throws, the error does not escape as an unhandled rejection. Falls back
to console.warn in development when the callback throws.

Add a test asserting no unhandledRejection fires when onBroadcastError throws.

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

* fix(broadcast-client): handle async onBroadcastError rejections

Support async onBroadcastError callbacks by calling .catch() on the
returned Promise, preventing unhandled rejections when the callback
rejects asynchronously.

Also extracts the console.warn fallback into warnBroadcastError to
deduplicate the warning logic.

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

* test(broadcast-client): use try/finally to ensure unhandledRejection listener cleanup

Prevents listener leaks into subsequent tests if an assertion throws
before process.off() is reached.

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

* refactor(broadcast-client): improve types, messages, and docs

- Export BroadcastErrorEvent interface with QueryKey typing so consumers
  can import the type directly
- Use discriminated union for internal BroadcastMessage (state only on
  updated) for more precise typing
- onBroadcastError now receives BroadcastErrorEvent (no internal state
  field) instead of the raw BroadcastMessage
- Differentiate dev warning messages: broadcast failures explain the
  structured-clone cause and consequence; onBroadcastError failures
  explicitly identify the hook as the source
- Remove warnBroadcastError helper in favour of context-specific inlined
  warn calls
- Fix duplicate queryClient.getQueryCache() call (use queryCache directly)
- Add JSDoc to all BroadcastQueryClientOptions fields
- Add onBroadcastError section to broadcastQueryClient docs with Sentry
  example

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

* test(broadcast-client): assert warn message when onBroadcastError throws or rejects

Add two tests that verify the '[broadcastQueryClient] onBroadcastError
threw while handling...' console.warn message is emitted in development
when the onBroadcastError callback itself throws synchronously or rejects
asynchronously.

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

* fix(broadcast-client): include state in 'added' broadcasts

The receiver's onmessage handler reads state for 'added' events to call
query.setState(state) and queryCache.build(..., state), but the sender
was not including state in the outbound message. This caused receiving
tabs to apply undefined state for newly added queries.

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

* test(broadcast-client): wrap warnSpy in try/finally to prevent spy leakage

If an assertion fails before mockRestore(), the console.warn spy would
leak into subsequent tests. Wrapping each spy block in try/finally
ensures restore always runs regardless of test outcome.

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

* ci: apply automated fixes

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-20 10:24:33 +02:00
Lucas127128
b8e35598ef
docs(svelte-query/quick-start): Add quick start docs (#11227)
* Add quick start docs in svelte query

* Apply suggestions from code review

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>

* ci: apply automated fixes

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-18 21:21:21 +02:00
Guilherme Rabelo
baa256c0d2
docs(examples): add Next.js App Router optimistic updates example (#10997)
* feat(examples): add Next.js App Router optimistic updates example

* refactor(examples/nextjs-app-optimistic-updates): apply post-review corrections

* refactor(examples/nextjs-app-optimistic-updates): apply post-review corrections

* update deps

* ref: remove other optimistic update examples

* ci: apply automated fixes

---------

Co-authored-by: Guilherme Rabelo <T0006742@randon.com.br>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-18 09:57:04 +02:00
Dominik Dorfmeister 🔮
279bb5508b
chore: update to ts 7 and move cut-off to 5.6 (#11212)
* update to ts 7 and move cut-off to 5.7

* changeset

* fix: use typescript v6 with tsup

* ci: apply automated fixes

* ref: update sveltejs/package

* ref: make ts6 the default typescript

* fix: lit build

* effing tsup

* move ignoreDeprecations to solid tsup config

* move ignoreDeprecations to relevant tsup configs

* better lit fix

* restore vue queryClient

* Revert "restore vue queryClient"

This reverts commit 4f95fc918a.

* fix things

* ignore devDep ordering

* vue needs to use ts6

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-17 22:50:18 +02:00
SiHyunLee
bcb030bfbb
docs: fix in-page anchor links to match the docs site's slug format (#11162) 2026-08-17 09:09:57 +02:00
Wonsuk Choi
6423f9eb9e
docs(vue-query/reference): hide React-only 'React.use()' mention from useInfiniteQuery (#11203) 2026-08-17 04:24:43 +09:00
Wonsuk Choi
0785da5510
docs(vue-query/guides/ssr): fix 'queryKey' to use array form (#11202) 2026-08-17 03:24:57 +09:00
hamed-bavar
bdfbeadb70
docs(vue-query/guides/suspense): update example to v5 object syntax (#11159)
docs(vue-query): update suspense guide example to v5 object syntax
2026-08-17 03:08:59 +09:00
Wonsuk Choi
b36374c150
docs(react-query/reference): fix 'queryClient' nesting in 'HydrationBoundary' options (#11201) 2026-08-17 02:45:36 +09:00
Wonsuk Choi
4ace03b55a
docs(react-query/reference): remove stale 'suspense' references left over from the v5 suspense split (#11200) 2026-08-17 02:44:07 +09:00
Wonsuk Choi
4446c3a1cb
docs(config.json): add 'Preact Reference' index entry to API Reference sidebar (#11198) 2026-08-17 00:08:58 +09:00
Wonsuk Choi
ed1c1bd34f
docs(reference): remove redundant page title heading from InfiniteQueryObserver, QueriesObserver, and QueryClient (#11197) 2026-08-16 23:26:46 +09:00
Wonsuk Choi
f1a435977f
docs: regenerate reference docs to drop redundant TypeDoc page title heading (#11196) 2026-08-16 22:08:19 +09:00
Wonsuk Choi
3f9d11b814
docs(config.json): drop redundant 'Functions /' prefix from svelte and angular sidebar labels (#11193) 2026-08-16 19:11:49 +09:00
Wonsuk Choi
9ad475e0ac
docs(config.json): register missing svelte API reference functions in sidebar (#11192) 2026-08-16 18:49:06 +09:00
Wonsuk Choi
7d4b6ed52e
docs(config.json): register missing angular API reference functions in sidebar (#11191) 2026-08-16 18:25:52 +09:00
Wonsuk Choi
a9f416bbae
docs: regenerate reference docs to fix stale content and Preact source links (#11189) 2026-08-16 17:58:55 +09:00
Wonsuk Choi
c5f29995fe
docs(solid-query/useQuery): document 'throwOnError' default value and its exceptions (#11170)
* docs(solid-query/useQuery): document 'throwOnError' default value

* docs(solid-query/useQuery): document SSR and 'suspense' exceptions to 'throwOnError' default
2026-08-16 14:06:04 +09:00
Wonsuk Choi
159982c80b
docs(react-query/useQuery): document 'throwOnError' default value (#11156)
* docs(react-query/useQuery): document 'throwOnError' default and its absence in suspense hooks

* docs(react-query/useQuery): use framework-agnostic wording for suspense throwOnError note

* docs(react-query/useQuery): remove inaccurate suspense-mode throwOnError note
2026-08-12 10:03:07 +09:00
Melih Arık
31c7f374e2
docs(angular-query): fix invalid imports and syntax error in guide examples (#11090)
* docs(angular-query): fix three broken examples in the guides

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-02 17:34:23 +09:00
Eliya Cohen
7ac45ed45c
fix(eslint-plugin-query): ignore call targets in exhaustive-deps (#11067)
* fix(query-eslint): ignore call targets in exhaustive deps

* fix(query-eslint): guard AST parent access

* fix(query-eslint): accept JSX scope references

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-07-21 14:50:23 +02:00
max
79d2384db5
docs(*): fix 'homogenous', 'stoage', 'supressed', 'compoennts' spelling typos (#11040)
* fix: correct spelling typos across docs, examples, and source comments

- homogenous -> homogeneous in 7 useQueries/createQueries source files
- stoage -> storage in react and vue createPersister docs
- supressed -> suppressed in react and angular pagination examples
- compoennts -> components in solid-start-streaming example

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

* docs(react-query/useSuspenseQueries): correct 'homogenous' typo to 'homogeneous' in comment

---------

Co-authored-by: maxtaran2010 <ocotifuzo727@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Wonsuk Choi <sukvvon@gmail.com>
2026-07-13 14:06:03 +09:00
Samuel Wai Weng Yong
f6cf12002a
docs({react,solid}-query): add missing 'errorUpdateCount' to 'useQuery' return signature (#11041)
* docs(react-query): add missing errorUpdateCount to useQuery return signature

* docs(react-query): move errorUpdateCount after errorUpdatedAt

* docs(react-query): keep 'errorUpdateCount' before 'errorUpdatedAt' to preserve alphabetical order

---------

Co-authored-by: Wonsuk Choi <sukvvon@gmail.com>
2026-07-13 03:28:00 +09:00
Wonsuk Choi
d6798b56b4
docs(angular-query/devtools): add the 'theme' option (#11002) 2026-06-29 12:10:31 +09:00
Dmytro Borysov
ad57c81fd3
docs(devtools): make markdown consistent (#10987)
Currently there is a bug, which prevents proper rendering of the links if there are both MD & HTML syntax in the same line (see https://tanstack.com/query/latest/docs/framework/react/devtools), probably should be fixed in @tanstack/markdown. Not sure that the source code of this package is published?

In the meantime, I just converted all links to html.

Converting everything (logos) to markdown won't work because we need to set width/height, which can't be done in markdown
2026-06-27 21:50:32 +02:00
Bartek Iwańczuk
b03390bfc8
docs: add Deno to installation instructions (#10971)
docs: add Deno to install instructions
2026-06-27 17:05:59 +02:00
Poetry Of Code
661c1afe79
docs(preact): add polling guide (#10991)
* docs(svelte): replace deprecated isLoading with isPending in overview

`isLoading` is a deprecated alias for `isPending && isFetching` and is
scheduled for removal in the next major version. The overview example
shows a standard (always-enabled) query, so `isPending` is the correct
flag. All other framework overview docs (React, Vue, Angular, Lit,
Preact) already use `isPending`.

Note: `isLoading` is intentionally retained in disabling-queries guides
where it is the right flag for disabled/lazy queries.

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

* docs(preact): add missing polling guide

The Polling guide existed for React, Vue, Solid, and Angular but was
missing from the Preact docs. Added the ref stub and wired it into
the nav config between Window Focus Refetching and Disabling Queries,
matching the ordering used by all other frameworks.

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

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-27 15:45:37 +02:00
Poetry Of Code
ac7a42d6a4
docs(svelte): replace deprecated isLoading with isPending in overview (#10990)
`isLoading` is a deprecated alias for `isPending && isFetching` and is
scheduled for removal in the next major version. The overview example
shows a standard (always-enabled) query, so `isPending` is the correct
flag. All other framework overview docs (React, Vue, Angular, Lit,
Preact) already use `isPending`.

Note: `isLoading` is intentionally retained in disabling-queries guides
where it is the right flag for disabled/lazy queries.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-27 15:40:35 +02:00
Benjamin Eckstein
fd495f2315
docs: add @codewithagents/openapi-react-query to community resources (#10974) 2026-06-27 15:32:07 +02:00
Jonghyeon Ko
1f84256a2e
docs: document the select typing caveat for parallel-queries hooks (#10984)
Inlining a `select` on a query object passed to `useQueries` /
`useSuspenseQueries` can't infer its `data` argument from the sibling
`queryFn` and falls back to `unknown` — a known TypeScript limitation
(TanStack/query#6556).

Document the two workarounds (annotate the `select` parameter, or define
the query with the `queryOptions` helper) in the React docs, and add type
tests guarding the behavior. Scoped to React for an easier review; the
other framework adapters can follow the same pattern in separate PRs.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 15:30:15 +02:00
Jakub Šimko
47e539a9f4
docs(react-query): recommend against using server actions in queryFn (#10927) 2026-06-14 13:04:16 +02:00
Wonsuk Choi
3270e09ac0
docs(reference/QueryCache): correct the 'find' and 'findAll' options to match their filter types (#10884) 2026-06-04 20:35:35 +09:00
Minh Lê
525e3168b5
docs(reference/QueryCache): use the v5 filters-object form in 'find' and 'findAll' examples (#10873)
docs(query): use the v5 filters-object form in QueryCache examples
2026-06-04 19:49:06 +09:00
Wonsuk Choi
dc0effd033
docs(framework/react/guides): replace deprecated 'isServer' with 'environmentManager.isServer()' (#10866) 2026-06-03 22:23:14 +09:00
Eliya Cohen
dc54932864
fix(eslint-plugin-query): detect rest destructuring on custom query hooks (#10775)
* fix(eslint-plugin-query): detect rest destructuring on custom query hooks

Adds an opportunistic type-aware path to no-rest-destructuring. When
TypeScript parser services are available, the rule resolves the call
expression's return type and reports rest destructuring on custom hooks
that return a TanStack Query result. Untyped projects keep the existing
AST-only behavior unchanged.

Closes #8951

* perf(eslint-plugin-query): gate type lookup behind cheap binding check

Only run the type checker on non-direct hook calls when the binding can
actually report (rest destructure or identifier), avoiding type lookups on
every variable declarator. Add tests for cross-statement rest destructuring
and interface-typed (non-alias) query results.

* ci: apply automated fixes

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-06-02 14:29:10 +02:00
Wonsuk Choi
dcc4a161d4
docs(framework/vue/devtools): inline the toggle and 'onClose' handler in the 'Embedded Mode' example to match the other adapters (#10856) 2026-06-01 17:07:14 +09:00
Wonsuk Choi
b1337cd568
docs(framework/vue/devtools): align the 'Embedded Mode' example with the other adapters and add the missing 'ref' import (#10855) 2026-06-01 16:23:30 +09:00
Wonsuk Choi
a79fc8d03b
docs(framework/vue/devtools): correct 'your React app' typo to 'your Vue app' in the Embedded Mode section (#10854) 2026-06-01 15:27:48 +09:00
Wonsuk Choi
1b4e73161f
docs(framework/{preact,solid}/devtools): add the 'Embedded Mode' section (#10853) 2026-06-01 15:10:21 +09:00
Cam Jackson
b125ba9c5c
docs(react-query): undefined vs. null in query-functions.md (#10008)
* docs(react-query): undefined vs. null in query-functions.md

* Apply suggestion from @TkDodo

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
2026-05-22 18:37:05 +02:00
0Jaemin0
98fd431f7c
docs(reference/QueryClient): clarify query client query methods (#10725)
* docs(reference): clarify query client query methods

* Apply suggestions from code review

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-05-22 18:07:42 +02:00