Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

useSuspenseQueries.md

33 lines1.1 KB

1---
2id: useSuspenseQueries
3title: useSuspenseQueries
4---
5​
6```tsx
7const result = useSuspenseQueries(options)
8```
9​
10**Options**
11​
12The same as for [useQueries](./useQueries.md), except that each `query` can't have:
13​
14- `throwOnError`
15- `enabled`
16- `placeholderData`
17​
18> The [`select` typing caveat](./useQueries.md#typescript-typing-the-select-option) for `useQueries` applies here as well: annotate the `select` parameter or use the [`queryOptions`](./queryOptions.md) helper to keep type inference.
19​
20**Returns**
21​
22Same structure as [useQueries](./useQueries.md), except that for each `query`:
23​
24- `data` is guaranteed to be defined
25- `isPlaceholderData` is missing
26- `status` is either `success` or `error`
27 - the derived flags are set accordingly.
28​
29**Caveats**
30​
31Keep in mind that the component will only re-mount after **all queries** have finished loading. Hence, if a query has gone stale in the time it took for all the queries to complete, it will be fetched again at re-mount. To avoid this, make sure to set a high enough `staleTime`.
32​
33[Cancellation](../guides/query-cancellation.md) does not work.