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
* feat(core): ensureInfiniteQueryData
* docs: ensureInfiniteQueryData
* feat(types): make sure we can't pass infiniteQueryOptions to non-infinite query functions like fetchQuery
`ensureInfiniteQueryData` is an asynchronous function that can be used to get an existing infinite query's cached data. If the query does not exist, `queryClient.fetchInfiniteQuery` will be called and its results returned.
207
+
208
+
```tsx
209
+
const data =awaitqueryClient.ensureInfiniteQueryData({
210
+
queryKey,
211
+
queryFn,
212
+
initialPageParam,
213
+
getNextPageParam,
214
+
})
215
+
```
216
+
217
+
**Options**
218
+
219
+
- the same options as [`fetchInfiniteQuery`](#queryclientfetchinfinitequery)
220
+
-`revalidateIfStale: boolean`
221
+
- Optional
222
+
- Defaults to `false`
223
+
- If set to `true`, stale data will be refetched in the background, but cached data will be returned immediately.
224
+
225
+
**Returns**
226
+
227
+
-`Promise<InfiniteData<TData, TPageParam>>`
228
+
203
229
## `queryClient.getQueriesData`
204
230
205
231
`getQueriesData` is a synchronous function that can be used to get the cached data of multiple queries. Only queries that match the passed queryKey or queryFilter will be returned. If there are no matching queries, an empty array will be returned.
0 commit comments