* Computes the page param of the page after the last one, with the `getNextPageParam` option. * @param options - The infinite query options. * @param data - The current pages and page params. * @returns The next page param, or `undefined` if there are no pages yet.
(
options: InfiniteQueryPageParamsOptions<any>,
{ pages, pageParams }: InfiniteData<unknown>,
)
| 150 | * @returns The next page param, or `undefined` if there are no pages yet. |
| 151 | */ |
| 152 | function getNextPageParam( |
| 153 | options: InfiniteQueryPageParamsOptions<any>, |
| 154 | { pages, pageParams }: InfiniteData<unknown>, |
| 155 | ): unknown | undefined { |
| 156 | const lastIndex = pages.length - 1 |
| 157 | return pages.length > 0 |
| 158 | ? options.getNextPageParam( |
| 159 | pages[lastIndex], |
| 160 | pages, |
| 161 | pageParams[lastIndex], |
| 162 | pageParams, |
| 163 | ) |
| 164 | : undefined |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * Computes the page param of the page before the first one, with the `getPreviousPageParam` |
no outgoing calls
no test coverage detected