Skip to content

Commit a22c838

Browse files
authored
Merge branch 'main' into fix/vue-query-useBaseQuery-prevent-dual-error-propagation
2 parents cf3705e + 610e8d1 commit a22c838

175 files changed

Lines changed: 4658 additions & 4324 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
BRANCH="${GITHUB_REF_NAME}"
4040
if [[ "$BRANCH" == *-pre ]]; then
4141
echo "prerelease=true" >> "$GITHUB_OUTPUT"
42-
echo "tag=pre" >> "$GITHUB_OUTPUT"
4342
elif [[ "$BRANCH" == *-maint ]]; then
4443
echo "tag=maint" >> "$GITHUB_OUTPUT"
4544
elif [[ "$BRANCH" =~ ^v[0-9]+$ ]]; then

docs/community-resources.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ others:
140140
url: 'https://www.kubb.dev/',
141141
description: 'Generate SDKs for all your APIs',
142142
},
143+
{
144+
title: '@codewithagents/openapi-react-query',
145+
url: 'https://github.com/codewithagents/openapi-zod-ts',
146+
description: 'Generate fully typed TanStack/React Query v5 hooks from an OpenAPI 3.1 spec, with Zod v4 runtime validation and an end-to-end pipeline (client, mocks, server).',
147+
},
143148
{
144149
title: 'OpenAPI codegen',
145150
url: 'https://github.com/fabien0102/openapi-codegen',

docs/config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,10 @@
864864
"label": "Window Focus Refetching",
865865
"to": "framework/preact/guides/window-focus-refetching"
866866
},
867+
{
868+
"label": "Polling",
869+
"to": "framework/preact/guides/polling"
870+
},
867871
{
868872
"label": "Disabling/Pausing Queries",
869873
"to": "framework/preact/guides/disabling-queries"

docs/framework/angular/devtools.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ title: Devtools
55

66
> For Chrome, Firefox, and Edge users: Third-party browser extensions are available for debugging TanStack Query directly in browser DevTools. These provide the same functionality as the framework-specific devtools packages:
77
>
8-
> - <img alt="Chrome logo" src="https://www.google.com/chrome/static/images/chrome-logo.svg" width="16" height="16" class="inline mr-1 not-prose" /> [Devtools for Chrome](https://chromewebstore.google.com/detail/tanstack-query-devtools/annajfchloimdhceglpgglpeepfghfai)
9-
> - <img alt="Firefox logo" src="https://upload.wikimedia.org/wikipedia/commons/a/a0/Firefox_logo%2C_2019.svg" width="16" height="16" class="inline mr-1 not-prose" /> [Devtools for Firefox](https://addons.mozilla.org/en-US/firefox/addon/tanstack-query-devtools/)
10-
> - <img alt="Edge logo" src="https://upload.wikimedia.org/wikipedia/commons/9/98/Microsoft_Edge_logo_%282019%29.svg" width="16" height="16" class="inline mr-1 not-prose" /> [Devtools for Edge](https://microsoftedge.microsoft.com/addons/detail/tanstack-query-devtools/edmdpkgkacmjopodhfolmphdenmddobj)
8+
> - <img alt="Chrome logo" src="https://www.google.com/chrome/static/images/chrome-logo.svg" width="16" height="16" class="inline mr-1 not-prose" /> <a href="https://chromewebstore.google.com/detail/tanstack-query-devtools/annajfchloimdhceglpgglpeepfghfai">Devtools for Chrome</a>
9+
> - <img alt="Firefox logo" src="https://upload.wikimedia.org/wikipedia/commons/a/a0/Firefox_logo%2C_2019.svg" width="16" height="16" class="inline mr-1 not-prose" /> <a href="https://addons.mozilla.org/en-US/firefox/addon/tanstack-query-devtools/">Devtools for Firefox</a>
10+
> - <img alt="Edge logo" src="https://upload.wikimedia.org/wikipedia/commons/9/98/Microsoft_Edge_logo_%282019%29.svg" width="16" height="16" class="inline mr-1 not-prose" /> <a href="https://microsoftedge.microsoft.com/addons/detail/tanstack-query-devtools/edmdpkgkacmjopodhfolmphdenmddobj">Devtools for Edge</a>
1111
1212
## Enable devtools
1313

docs/framework/preact/devtools.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ When you begin your Preact Query journey, you'll want these devtools by your sid
99

1010
> For Chrome, Firefox, and Edge users: Third-party browser extensions are available for debugging TanStack Query directly in browser DevTools. These provide the same functionality as the framework-specific devtools packages:
1111
>
12-
> - <img alt="Chrome logo" src="https://www.google.com/chrome/static/images/chrome-logo.svg" width="16" height="16" class="inline mr-1 not-prose" /> [Devtools for Chrome](https://chromewebstore.google.com/detail/tanstack-query-devtools/annajfchloimdhceglpgglpeepfghfai)
13-
> - <img alt="Firefox logo" src="https://upload.wikimedia.org/wikipedia/commons/a/a0/Firefox_logo%2C_2019.svg" width="16" height="16" class="inline mr-1 not-prose" /> [Devtools for Firefox](https://addons.mozilla.org/en-US/firefox/addon/tanstack-query-devtools/)
14-
> - <img alt="Edge logo" src="https://upload.wikimedia.org/wikipedia/commons/9/98/Microsoft_Edge_logo_%282019%29.svg" width="16" height="16" class="inline mr-1 not-prose" /> [Devtools for Edge](https://microsoftedge.microsoft.com/addons/detail/tanstack-query-devtools/edmdpkgkacmjopodhfolmphdenmddobj)
12+
> - <img alt="Chrome logo" src="https://www.google.com/chrome/static/images/chrome-logo.svg" width="16" height="16" class="inline mr-1 not-prose" /> <a href="https://chromewebstore.google.com/detail/tanstack-query-devtools/annajfchloimdhceglpgglpeepfghfai">Devtools for Chrome</a>
13+
> - <img alt="Firefox logo" src="https://upload.wikimedia.org/wikipedia/commons/a/a0/Firefox_logo%2C_2019.svg" width="16" height="16" class="inline mr-1 not-prose" /> <a href="https://addons.mozilla.org/en-US/firefox/addon/tanstack-query-devtools/">Devtools for Firefox</a>
14+
> - <img alt="Edge logo" src="https://upload.wikimedia.org/wikipedia/commons/9/98/Microsoft_Edge_logo_%282019%29.svg" width="16" height="16" class="inline mr-1 not-prose" /> <a href="https://microsoftedge.microsoft.com/addons/detail/tanstack-query-devtools/edmdpkgkacmjopodhfolmphdenmddobj">Devtools for Edge</a>
1515
1616
## Install and Import the Devtools
1717

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
id: polling
3+
title: Polling
4+
ref: docs/framework/react/guides/polling.md
5+
replace: { '@tanstack/react-query': '@tanstack/preact-query' }
6+
---

docs/framework/react/devtools.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ When you begin your React Query journey, you'll want these devtools by your side
99

1010
> For Chrome, Firefox, and Edge users: Third-party browser extensions are available for debugging TanStack Query directly in browser DevTools. These provide the same functionality as the framework-specific devtools packages:
1111
>
12-
> - <img alt="Chrome logo" src="https://www.google.com/chrome/static/images/chrome-logo.svg" width="16" height="16" class="inline mr-1 not-prose" /> [Devtools for Chrome](https://chromewebstore.google.com/detail/tanstack-query-devtools/annajfchloimdhceglpgglpeepfghfai)
13-
> - <img alt="Firefox logo" src="https://upload.wikimedia.org/wikipedia/commons/a/a0/Firefox_logo%2C_2019.svg" width="16" height="16" class="inline mr-1 not-prose" /> [Devtools for Firefox](https://addons.mozilla.org/en-US/firefox/addon/tanstack-query-devtools/)
14-
> - <img alt="Edge logo" src="https://upload.wikimedia.org/wikipedia/commons/9/98/Microsoft_Edge_logo_%282019%29.svg" width="16" height="16" class="inline mr-1 not-prose" /> [Devtools for Edge](https://microsoftedge.microsoft.com/addons/detail/tanstack-query-devtools/edmdpkgkacmjopodhfolmphdenmddobj)
12+
> - <img alt="Chrome logo" src="https://www.google.com/chrome/static/images/chrome-logo.svg" width="16" height="16" class="inline mr-1 not-prose" /> <a href="https://chromewebstore.google.com/detail/tanstack-query-devtools/annajfchloimdhceglpgglpeepfghfai">Devtools for Chrome</a>
13+
> - <img alt="Firefox logo" src="https://upload.wikimedia.org/wikipedia/commons/a/a0/Firefox_logo%2C_2019.svg" width="16" height="16" class="inline mr-1 not-prose" /> <a href="https://addons.mozilla.org/en-US/firefox/addon/tanstack-query-devtools/">Devtools for Firefox</a>
14+
> - <img alt="Edge logo" src="https://upload.wikimedia.org/wikipedia/commons/9/98/Microsoft_Edge_logo_%282019%29.svg" width="16" height="16" class="inline mr-1 not-prose" /> <a href="https://microsoftedge.microsoft.com/addons/detail/tanstack-query-devtools/edmdpkgkacmjopodhfolmphdenmddobj">Devtools for Edge</a>
1515
1616
> For React Native users: A third-party native macOS app is available for debugging React Query in ANY js-based application. Monitor queries across devices in real-time. Check it out here: [rn-better-dev-tools](https://github.com/LovesWorking/rn-better-dev-tools)
1717

docs/framework/react/guides/parallel-queries.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,8 @@ function App({ users }) {
5656
```
5757

5858
[//]: # 'Example2'
59+
[//]: # 'TypeScriptSelect'
60+
61+
> When using TypeScript, an inline `select` written on a query object passed to `useQueries` can't infer its `data` argument from that same object's `queryFn` — it falls back to `unknown`. Annotate the `select` parameter explicitly, or define the query with the [`queryOptions`](../reference/queryOptions.md) helper, to keep type inference. See [this known limitation](https://github.com/TanStack/query/issues/6556).
62+
63+
[//]: # 'TypeScriptSelect'

docs/framework/react/installation.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ or
3131
bun add @tanstack/react-query
3232
```
3333

34+
or
35+
36+
```bash
37+
deno add @tanstack/react-query
38+
```
39+
3440
[//]: # 'Compatibility'
3541

3642
React Query is compatible with React v18+ and works with ReactDOM and React Native.

docs/framework/react/reference/useQueries.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,81 @@ The `combine` function will only re-run if:
6565
- any of the query results changed
6666

6767
This means that an inlined `combine` function, as shown above, will run on every render. To avoid this, you can wrap the `combine` function in `useCallback`, or extract it to a stable function reference if it doesn't have any dependencies.
68+
69+
## TypeScript: typing the `select` option
70+
71+
Unlike `useQuery`, `useQueries` cannot infer the `data` argument of an _inline_ `select` from its sibling `queryFn`. Because `useQueries` infers the type of the whole `queries` array at once, the `select` parameter of a query object written inline cannot be contextually typed from that same object's `queryFn`, so it falls back to `unknown`. This is a [known TypeScript limitation](https://github.com/TanStack/query/issues/6556).
72+
73+
```tsx
74+
useQueries({
75+
queries: [
76+
{
77+
queryKey: ['post', 1],
78+
queryFn: () => fetchPost(1),
79+
// ❌ `data` is `unknown` here
80+
select: (data) => data.title,
81+
},
82+
],
83+
})
84+
```
85+
86+
There are two supported workarounds:
87+
88+
1. Annotate the `select` parameter explicitly:
89+
90+
```tsx
91+
useQueries({
92+
queries: [
93+
{
94+
queryKey: ['post', 1],
95+
queryFn: () => fetchPost(1),
96+
// ✅ `data` is `Post`
97+
select: (data: Post) => data.title,
98+
},
99+
],
100+
})
101+
```
102+
103+
2. Define the query with the [`queryOptions`](./queryOptions.md) helper, which resolves its types in a single object _before_ it reaches `useQueries`:
104+
105+
```tsx
106+
const postOptions = (id: number) =>
107+
queryOptions({
108+
queryKey: ['post', id],
109+
queryFn: () => fetchPost(id),
110+
// ✅ `data` is `Post`
111+
select: (data) => data.title,
112+
})
113+
114+
useQueries({ queries: [postOptions(1), postOptions(2)] })
115+
```
116+
117+
The same limitation applies when you spread a `queryOptions` result to override its `select` inline — the overriding `select` still falls back to `unknown`:
118+
119+
```tsx
120+
useQueries({
121+
queries: [
122+
{
123+
...postOptions(1),
124+
// ❌ `data` is `unknown` here
125+
select: (data) => data.title,
126+
},
127+
],
128+
})
129+
```
130+
131+
Wrap the spread in `queryOptions` again so the override is resolved before it reaches `useQueries`:
132+
133+
```tsx
134+
useQueries({
135+
queries: [
136+
queryOptions({
137+
...postOptions(1),
138+
// ✅ `data` is `Post`
139+
select: (data) => data.title,
140+
}),
141+
],
142+
})
143+
```
144+
145+
The same applies to [`useSuspenseQueries`](./useSuspenseQueries.md).

0 commit comments

Comments
 (0)