* 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>,
)
| 147 | * @returns The next page param, or `undefined` if there are no pages yet. |
| 148 | */ |
| 149 | function getNextPageParam( |
| 150 | options: InfiniteQueryPageParamsOptions<any>, |
| 151 | { pages, pageParams }: InfiniteData<unknown>, |
| 152 | ): unknown | undefined { |
| 153 | const lastIndex = pages.length - 1 |
| 154 | return pages.length > 0 |
| 155 | ? options.getNextPageParam( |
| 156 | pages[lastIndex], |
| 157 | pages, |
| 158 | pageParams[lastIndex], |
| 159 | pageParams, |
| 160 | ) |
| 161 | : undefined |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * Computes the page param of the page before the first one, with the `getPreviousPageParam` |
no outgoing calls
no test coverage detected