You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/pages/guides/infinite-queries.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,6 +95,27 @@ function Projects() {
95
95
96
96
When an infinite query becomes `stale` and needs to be refetched, each group is fetched `sequentially`, starting from the first one. This ensures that even if the underlying data is mutated, we're not using stale cursors and potentially getting duplicates or skipping records. If an infinite query's results are ever removed from the queryCache, the pagination restarts at the initial state with only the initial group being requested.
97
97
98
+
### refetchPage
99
+
100
+
If you only want to actively refetch a subset of all pages, you can pass the `refetchPage` function to `refetch` returned from `useInfiniteQuery`.
refetch({ refetchPage: (page, index) => index ===0 })
109
+
```
110
+
111
+
You can also pass this function as part of the 3rd argument (`options`) to [queryClient.refetchQueries](/reference/QueryClient#queryclientrefetchqueries), [queryClient.invalidateQueries](/reference/QueryClient#queryclientinvalidatequeries) or [queryClient.resetQueries](/reference/QueryClient#queryclientresetqueries).
The function is executed for each page, and only pages where this function returns `true` will be refetched.
118
+
98
119
## What if I need to pass custom information to my query function?
99
120
100
121
By default, the variable returned from `getNextPageParam` will be supplied to the query function, but in some cases, you may want to override this. You can pass custom variables to the `fetchNextPage` function which will override the default variable like so:
Copy file name to clipboardExpand all lines: docs/src/pages/reference/QueryClient.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -194,7 +194,7 @@ const data = queryClient.getQueriesData(queryKey | filters)
194
194
195
195
-`[queryKey:QueryKey, data:TData | unknown][]`
196
196
- An array of tuples for the matched query keys, or `[]` if there are no matches. The tuples are the query key and its associated data.
197
-
197
+
198
198
**Caveats**
199
199
200
200
Because the returned data in each tuple can be of varying structures (i.e. using a filter to return "active" queries can return different data types), the `TData` generic defaults to `unknown`. If you provide a more specific type to `TData` it is assumed that you are certain each tuple's data entry is all the same type.
0 commit comments