Skip to content

Commit 1bc4afd

Browse files
committed
Document infinite query option fields
1 parent 16cdf78 commit 1bc4afd

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

packages/toolkit/src/query/core/apiState.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@ export type PageParamFunction<DataType, PageParam> = (
3838
) => PageParam | undefined | null
3939

4040
export type InfiniteQueryConfigOptions<DataType, PageParam> = {
41+
/**
42+
* The initial page parameter to use for the first page fetch.
43+
*/
4144
initialPageParam: PageParam
45+
/**
46+
* If specified, only keep this many pages in cache at once.
47+
* If additional pages are fetched, older pages in the other
48+
* direction will be dropped from the cache.
49+
*/
4250
maxPages?: number
4351
/**
4452
* This function can be set to automatically get the previous cursor for infinite queries.

packages/toolkit/src/query/createApi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export interface CreateApiOptions<
9898
*/
9999
serializeQueryArgs?: SerializeQueryArgs<unknown>
100100
/**
101-
* Endpoints are just a set of operations that you want to perform against your server. You define them as an object using the builder syntax. There are two basic endpoint types: [`query`](../../rtk-query/usage/queries) and [`mutation`](../../rtk-query/usage/mutations).
101+
* Endpoints are a set of operations that you want to perform against your server. You define them as an object using the builder syntax. There are two basic endpoint types: [`query`](../../rtk-query/usage/queries) and [`mutation`](../../rtk-query/usage/mutations).
102102
*/
103103
endpoints(
104104
build: EndpointBuilder<BaseQuery, TagTypes, ReducerPath>,

packages/toolkit/src/query/endpointDefinitions.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,12 @@ export interface InfiniteQueryExtraOptions<
601601
*/
602602
invalidatesTags?: never
603603

604+
/**
605+
* Required options to configure the infinite query behavior.
606+
* `initialPageParam` and `getNextPageParam` are required, to
607+
* ensure the infinite query can properly fetch the next page of data. `initialPageparam` may be specified when using the
608+
* endpoint, to override the default value.
609+
*/
604610
infiniteQueryOptions: InfiniteQueryConfigOptions<ResultType, PageParam>
605611

606612
/**

0 commit comments

Comments
 (0)