Skip to content

Commit

Permalink
chore: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
brunolopesr committed Jun 19, 2024
1 parent d0e4879 commit b4b21d6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,14 @@
"label": "infiniteQueryOptions",
"to": "framework/react/reference/infiniteQueryOptions"
},
{
"label": "usePrefetchQuery",
"to": "framework/react/reference/usePrefetchQuery"
},
{
"label": "usePrefetchInfiniteQuery",
"to": "framework/react/reference/usePrefetchInfiniteQuery"
},
{
"label": "QueryErrorResetBoundary",
"to": "framework/react/reference/QueryErrorResetBoundary"
Expand Down
2 changes: 1 addition & 1 deletion docs/framework/react/guides/prefetching.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ This starts fetching `'article-comments'` immediately and flattens the waterfall

[//]: # 'Suspense'

If you want to prefetch together with Suspense, you will have to do things a bit differently. You can't use `useSuspenseQueries` to prefetch, since the prefetch would block the component from rendering. You also can not use `useQuery` for the prefetch, because that wouldn't start the prefetch until after suspenseful query had resolved. For this scenario, you can use the `usePrefetchQuery` or the `usePrefetchInfiniteQuery` hooks available in the library
If you want to prefetch together with Suspense, you will have to do things a bit differently. You can't use `useSuspenseQueries` to prefetch, since the prefetch would block the component from rendering. You also can not use `useQuery` for the prefetch, because that wouldn't start the prefetch until after suspenseful query had resolved. For this scenario, you can use the [`usePrefetchQuery`](../reference/usePrefetchQuery) or the [`usePrefetchInfiniteQuery`](../reference/usePrefetchInfiniteQuery.md) hooks available in the library

You can now use `useSuspenseQuery` in the component that actually needs the data. You _might_ want to wrap this later component in its own `<Suspense>` boundary so the "secondary" query we are prefetching does not block rendering of the "primary" data.

Expand Down
4 changes: 2 additions & 2 deletions docs/framework/react/reference/usePrefetchInfiniteQuery.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const result = usePrefetchInfiniteQuery(options)

**Options**

You can pass everything to `usePrefetchInfiniteQuery` that you can pass to [`infiniteQueryOptions`](../infiniteQueryOptions) or [`useInfiniteQuery`](../useInfiniteQuery). Some options will have no effect because, under the hood, `usePrefetchInfiniteQuery` uses `queryClient.prefetchInfiniteQuery`. Since the options are general, TypeScript will not warn you about any excess properties.
You can pass everything to `usePrefetchInfiniteQuery` that you can pass to [`queryClient.prefetchInfiniteQuery`](../../../reference/QueryClient#queryclientprefetchinfinitequery). Remember that some of them are required as below:

- `queryKey: QueryKey`

Expand All @@ -34,4 +34,4 @@ You can pass everything to `usePrefetchInfiniteQuery` that you can pass to [`inf

- **Returns**

The `usePrefetchInfiniteQuery` does not return nothing, it should be used just to fire a prefetch during render, before any suspense boundaries.
The `usePrefetchInfiniteQuery` does not return nothing, it should be used just to fire a prefetch during render, before a suspense boundary that wraps a component that uses [`useSuspenseInfiniteQuery`](../reference/useSuspenseInfiniteQuery)
4 changes: 2 additions & 2 deletions docs/framework/react/reference/usePrefetchQuery.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const result = usePrefetchQuery(options)

**Options**

You can pass everything to `usePrefetchQuery` that you can pass to [`queryOptions`](../queryOptions) or [`useQuery`](../useQuery). Some options will have no effect because, under the hood, `usePrefetchQuery` uses `queryClient.prefetchQuery`. Since the options are general, TypeScript will not warn you about any excess properties.
You can pass everything to `usePrefetchQuery` that you can pass to [`queryClient.prefetchQuery`](../../../reference/QueryClient#queryclientprefetchquery). Remember that some of them are required as below:

- `queryKey: QueryKey`

Expand All @@ -21,4 +21,4 @@ You can pass everything to `usePrefetchQuery` that you can pass to [`queryOption

**Returns**

The `usePrefetchQuery` does not return nothing, it should be used just to fire a prefetch during render, before any suspense boundaries.
The `usePrefetchQuery` does not return nothing, it should be used just to fire a prefetch during render, before a suspense boundary that wraps a component that uses [`useSuspenseQuery`](../reference/useSuspenseQuery).

0 comments on commit b4b21d6

Please sign in to comment.