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

4,997 commits

Author SHA1 Message Date
Dominik Dorfmeister 🔮
dce04b5c5a
chore: Add AI guidelines to contribution guide (#11213) 2026-08-17 20:14:36 +02:00
Abdul Wasay
3bc8edfa01
fix(eslint-plugin-query): avoid prototype property false-positives in no-unstable-deps (#11188)
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-17 19:49:57 +02:00
Lazizbek Ergashev
5633820181
fix(lit-query): add DataTag to the queryKey returned by infiniteQueryOptions (#11146)
* fix(lit-query): add DataTag to the queryKey returned by infiniteQueryOptions

* test(lit-query): cover error brand and callback updater for infiniteQueryOptions

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-17 14:54:22 +02:00
Shelley Vohr
4a9bef6cf1
fix(query-core): release the retryer once a fetch settles (#11163)
A query kept its last retryer for life, and the settled promise holds that
fetch's raw result: a second full copy of the data once a refetch has been
structurally shared into state.data, and still held after reset() or removal.

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-17 14:45:44 +02:00
Manan Telrandhe
6613753cbe
docs(examples): use webpack in Next.js examples for StackBlitz compatibility (#11110) 2026-08-17 14:44:53 +02:00
Dominik Dorfmeister 🔮
326aaf1333
fix(query-core): resetQueries now preserves the queries matched before query.reset() changes their state. (#11211)
fix: resetQueries
2026-08-17 14:28:17 +02:00
Ciarán Curley
c6fc17cfad
feat(query-core): add simplified query methods (#10658)
* feat(query-core): add simplified query methods

* tests: stage adapter queryOptions coverage for new query methods

* ref: disallow `enabled`

* ci: apply automated fixes

* remove outdated test

* test(lit): remove other outdated test

---------

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-17 13:59:13 +02:00
Amariah Abishai
bef4bc780c
fix(query-core): resolve suspense when query data is set programmatically (#11036)
* fix(query-core): resolve suspense when query data is set programmatically

When useSuspenseQuery is used and setQueryData populates the cache
while a fetch is in-flight, the suspense boundary stays stuck on the
original fetch promise. This prevents streamedQuery and manual cache
updates from releasing suspense.

Modify fetchOptimistic in queryObserver to use Promise.race between
the fetch promise and a cache subscriber that listens for 'updated'
events. When data appears in the cache via setQueryData or a streamed
chunk, the race resolves immediately without aborting the fetch.
This allows the suspense boundary to release and show the available
data while the fetch continues in the background.

Closes #10924

Co-authored-by: atlarix-agent <agent@atlarix.dev>

* chore: add changeset for suspense setQueryData fix

Co-authored-by: atlarix-agent <agent@atlarix.dev>

* fix(query-core): prevent subscription leak in fetchOptimistic on fetch rejection

unsubscribe() was only called in the .then() success path. If
query.fetch() rejected before the cache subscriber resolved the race,
the subscription leaked — staying registered on QueryCache indefinitely
and checking a stale queryHash on every 'updated' event.

Use .finally() to ensure unsubscribe() runs on both success and
rejection, preserving the original promise type through the chain.

Co-authored-by: atlarix-agent <agent@atlarix.dev>

* fix(query-core): settle floating promise in fetchOptimistic and add undefined test

- Resolve the subscriber promise when fetch succeeds so both branches
  of Promise.race always settle, avoiding a permanently pending promise
- Move resolution into .then() rather than .finally() so fetch failures
  still propagate through Promise.race rejection
- Add test: setQueryData with undefined must NOT release suspense,
  documenting the query.state.data !== undefined guard

Co-authored-by: atlarix-agent <agent@atlarix.dev>

* Update packages/query-core/src/queryObserver.ts

* test(queryObserver): cover cached data resolution

---------

Co-authored-by: DeepSeek V4 Pro agent <agent@atlarix.dev>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-17 10:19:39 +02:00
Alexander Kolesnik
5448063f82
fix(query-core): ignore a retained thenable callback invoked after settling (#11128)
* test(query-core): add unit tests for thenable

* fix(query-core): ignore a retained thenable callback invoked after settling

* chore: add changeset

* 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-17 09:52:21 +02:00
Yogesh Kumar
1a779e585d
fix(scripts): make the docs link check work on Windows (#11181)
'relativeLinkExists' builds the target path with 'path.resolve', which
uses the platform separator, but then matches it against '/examples/'
and rewrites it with a regex written in forward slashes.

On Windows the resolved path uses backslashes, so neither pattern
matches. Every documentation link that points at an example is looked up
as a markdown file under 'docs/framework/<name>/examples/' instead of a
directory under 'examples/<name>/', and 'pnpm test:docs' reports 27
broken links that are fine on CI.

Normalize the separators before the two comparisons. Node accepts
forward slashes on Windows, so the resolved path stays usable.

Co-authored-by: Yogesh Kumar <webdev1@futeservices.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-08-17 09:16:11 +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
ed5e1d3a87
chore(generate-docs): hide redundant TypeDoc page title heading (#11194) 2026-08-16 21:53:52 +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
Alem Tuzlak
46d7f02f1c
docs: use the dynamic README header endpoint (#11136)
* docs: use the dynamic README header endpoint

* docs: add README header banners to the framework adapter packages
2026-08-03 13:43:19 +02: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
SiHyunLee
96fbd7d38e
docs(CONTRIBUTING): remove stale gitpod one-click setup section (#11096) 2026-08-02 16:17:51 +09:00
SiHyunLee
6efc619123
docs(CONTRIBUTING): replace 'npm run test' and 'npx nx' commands with 'pnpm' equivalents (#11095)
docs(CONTRIBUTING): replace 'npm run test' and 'npx nx' command with 'pnpm' equivalents
2026-08-02 16:07:27 +09:00
Wonsuk Choi
9d24c45545
test(react-query/useQuery.promise): unskip 'cancelQueries' while suspending test by keeping 'queryFn' in-flight (#10910)
* test(react-query/useQuery.promise): unskip 'cancelQueries' while suspending test by keeping 'queryFn' in-flight

* test(react-query/useQuery.promise): clarify why 'sleep' is extended in cancel-while-suspending test
2026-07-29 10:03:48 +09:00
kinsk2839
75b2d101f0
test(svelte-query/createQuery): replace 'toBeDefined' with exact-value assertion (#11126)
* test(svelte-query/createQuery): assert exact queryKey instead of loose 'toBeDefined'

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-28 11:29:09 +09:00
ChangJun Park
e396148c07
test(query-devtools/Devtools): add test for rendering a hydrated query with a custom hash function (#11055)
* Protect restored custom-hash queries in devtools

Exercise the full dehydrate, hydrate, and query-row rendering path for a per-query custom queryKeyHashFn. This locks the queryHash lookup behavior introduced by #10750 and covers the persistence failure reported in #6958.

Constraint: The runtime lookup fix already shipped in #10750

Rejected: Reapply queryCache.get changes | current main already contains the implementation

Confidence: high

Scope-risk: narrow

Tested: query-devtools 246 tests; ESLint; TypeScript current; Prettier

Related: TanStack/query#6958

* test(query-devtools/Devtools): use 'advanceTimersByTimeAsync' for consistency and remove redundant 'clear'

* test(query-devtools/Devtools): move custom-hash hydration test to the end of 'query list'

* test(query-devtools/Devtools): align custom-hash test title with the 'when X' convention

---------

Co-authored-by: Wonsuk Choi <sukvvon@gmail.com>
2026-07-27 01:54:54 +09:00
Wonsuk Choi
5972ae6e11
test(svelte-query): replace 'toBeDefined' with exact-value assertion (#11124)
test(svelte-query): assert exact values instead of loose matchers
2026-07-27 00:58:26 +09:00
Wonsuk Choi
fbe532c477
test({react,preact}-query): replace 'toBeDefined'/'toBeFalsy' with exact-value assertions (#11123)
test({react,preact}-query): assert exact values instead of loose matchers
2026-07-27 00:57:58 +09:00
Wonsuk Choi
f99c105e8a
test(lit-query): replace 'toBeDefined'/'toBeGreaterThan' with exact-value assertions (#11122)
test(lit-query): assert exact values instead of loose matchers
2026-07-27 00:57:13 +09:00
Wonsuk Choi
e330cee106
test(angular-query): replace 'toBeDefined' with exact-value assertion (#11121)
test(angular-query): assert exact values instead of loose matchers
2026-07-27 00:56:47 +09:00
karl
3bf3adcbb4
test(query-core): assert exact values instead of loose matchers in remaining tests (#11093)
Co-authored-by: Wonsuk Choi <sukvvon@gmail.com>
2026-07-27 00:15:21 +09:00
karl
f320db5a4c
test(solid-query): assert exact values instead of loose matchers (#11105)
Co-authored-by: Wonsuk Choi <sukvvon@gmail.com>
2026-07-26 23:56:26 +09:00
Lachlan Collins
fd50fa14d2
ci: update renovate.json (#11114) 2026-07-24 22:22:47 +10:00
SiHyunLee
a3b0612729
test({react,preact}-query/usePrefetchQuery): use the '.then()' convention consistently (#11091)
Co-authored-by: Wonsuk Choi <sukvvon@gmail.com>
2026-07-24 12:30:17 +09:00
SiHyunLee
98d2bfda92
docs(CONTRIBUTING): link '.nvmrc' reference to the actual file (#11097) 2026-07-24 12:19:12 +09:00
github-actions[bot]
86bb8a6fb2
ci: Version Packages (#11094) release-2026-07-21-1305 @tanstack/angular-query-experimental@5.101.4 @tanstack/eslint-plugin-query@5.101.4 @tanstack/lit-query@0.2.11 @tanstack/preact-query-devtools@5.101.4 @tanstack/preact-query-persist-client@5.101.4 @tanstack/preact-query@5.101.4 @tanstack/query-async-storage-persister@5.101.4 @tanstack/query-broadcast-client-experimental@5.101.4 @tanstack/query-core@5.101.4 @tanstack/query-devtools@5.101.4 @tanstack/query-persist-client-core@5.101.4 @tanstack/query-sync-storage-persister@5.101.4 @tanstack/react-query-devtools@5.101.4 @tanstack/react-query-next-experimental@5.101.4 @tanstack/react-query-persist-client@5.101.4 @tanstack/react-query@5.101.4 @tanstack/solid-query-devtools@5.101.4 @tanstack/solid-query-persist-client@5.101.4 @tanstack/solid-query@5.101.4 @tanstack/svelte-query-devtools@6.1.38 @tanstack/svelte-query-persist-client@6.1.38 @tanstack/svelte-query@6.1.38 @tanstack/vue-query-devtools@6.1.38 @tanstack/vue-query@5.101.4
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-21 15:00:30 +02: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
github-actions[bot]
181ea826cb
ci: Version Packages (#11089) release-2026-07-20-1205 @tanstack/angular-query-experimental@5.101.3 @tanstack/eslint-plugin-query@5.101.3 @tanstack/lit-query@0.2.10 @tanstack/preact-query-devtools@5.101.3 @tanstack/preact-query-persist-client@5.101.3 @tanstack/preact-query@5.101.3 @tanstack/query-async-storage-persister@5.101.3 @tanstack/query-broadcast-client-experimental@5.101.3 @tanstack/query-core@5.101.3 @tanstack/query-devtools@5.101.3 @tanstack/query-persist-client-core@5.101.3 @tanstack/query-sync-storage-persister@5.101.3 @tanstack/react-query-devtools@5.101.3 @tanstack/react-query-next-experimental@5.101.3 @tanstack/react-query-persist-client@5.101.3 @tanstack/react-query@5.101.3 @tanstack/solid-query-devtools@5.101.3 @tanstack/solid-query-persist-client@5.101.3 @tanstack/solid-query@5.101.3 @tanstack/svelte-query-devtools@6.1.37 @tanstack/svelte-query-persist-client@6.1.37 @tanstack/svelte-query@6.1.37 @tanstack/vue-query-devtools@6.1.37 @tanstack/vue-query@5.101.3
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-20 14:01:04 +02:00
James Garbutt
7e3c822a10
perf: special case arrays in partialMatchKey (#11084)
This does 2 things:

1. If the values being compared are both arrays, iterate through them
   directly
2. Use a `for...of` instead of allocating an arrow function per
   recursive call

The results:

| Task name | Latency avg (ns) | Latency med (ns) | Throughput avg (ops/s) | Throughput med (ops/s) | Samples |
| -- | -- | -- | -- | -- | -- |
| 'partialMatchKey dev' | '38.21 ± 0.16%' | '42.00 ± 0.00' | '24035274 ± 0.00%' | '23809524 ± 1' | 13086480 |
| 'partialMatchKey prod' | '102.05 ± 0.52%' | '84.00 ± 1.00' | '10289814 ± 0.02%' | '11904762 ± 143431' | 4899508 |

Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>
2026-07-20 13:36:12 +02:00
Wonsuk Choi
0a612ec662
test(angular-query-persist-client): use the '.then()' convention consistently (#11088) 2026-07-20 19:39:36 +09:00
Wonsuk Choi
ff24bf7b31
test(solid-query): use the '.then()' convention consistently (#11087)
* test(solid-query/useMutation): use the '.then()' convention consistently

* test(solid-query/useQuery): use the '.then()' convention consistently

* test(solid-query-persist-client): use the '.then()' convention consistently
2026-07-20 19:39:14 +09:00
Wonsuk Choi
6d55b0759b
test({react,preact}-query): use the '.then()' convention consistently (#11085)
* 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
2026-07-20 19:38:28 +09:00
Wonsuk Choi
a42b8a3b00
test(query-core/queryObserver): use the '.then()' convention consistently (#11086) 2026-07-20 12:32:07 +09:00