* Computes the page param of the page before the first one, with the `getPreviousPageParam` * option. * @param options - The infinite query options. * @param data - The current pages and page params. * @returns The previous page param, or `undefined` if there are no pages yet or no * `getPrevio
(
options: InfiniteQueryPageParamsOptions<any>,
{ pages, pageParams }: InfiniteData<unknown>,
)
| 173 | * `getPreviousPageParam` option. |
| 174 | */ |
| 175 | function getPreviousPageParam( |
| 176 | options: InfiniteQueryPageParamsOptions<any>, |
| 177 | { pages, pageParams }: InfiniteData<unknown>, |
| 178 | ): unknown | undefined { |
| 179 | return pages.length > 0 |
| 180 | ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) |
| 181 | : undefined |
| 182 | } |
| 183 | |
| 184 | /** |
| 185 | * Checks if there is a next page. |