Skip to content

Commit

Permalink
docs: Fix formatting, run CI on docs changes (#7018)
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlancollins committed Mar 4, 2024
1 parent 663afdc commit aa9a789
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ name: pr
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'media/**'
- '**/*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
Expand Down
29 changes: 16 additions & 13 deletions docs/framework/react/reference/useQueries.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ title: useQueries
The `useQueries` hook can be used to fetch a variable number of queries:

```tsx
const ids = [1,2,3]
const ids = [1, 2, 3]
const results = useQueries({
queries: ids.map(id => (
{ queryKey: ['post', id], queryFn: () => fetchPost(id), staleTime: Infinity }
)),
queries: ids.map((id) => ({
queryKey: ['post', id],
queryFn: () => fetchPost(id),
staleTime: Infinity,
})),
})
```

Expand Down Expand Up @@ -38,17 +40,18 @@ The `useQueries` hook returns an array with all the query results. The order ret
If you want to combine `data` (or other Query information) from the results into a single value, you can use the `combine` option. The result will be structurally shared to be as referentially stable as possible.

```tsx
const ids = [1,2,3]
const ids = [1, 2, 3]
const combinedQueries = useQueries({
queries: ids.map(id => (
{ queryKey: ['post', id], queryFn: () => fetchPost(id) }
)),
queries: ids.map((id) => ({
queryKey: ['post', id],
queryFn: () => fetchPost(id),
})),
combine: (results) => {
return ({
data: results.map(result => result.data),
pending: results.some(result => result.isPending),
})
}
return {
data: results.map((result) => result.data),
pending: results.some((result) => result.isPending),
}
},
})
```

Expand Down

0 comments on commit aa9a789

Please sign in to comment.