MCPcopy Create free account
hub / github.com/TanStack/query / getPreviousPageParam

Function getPreviousPageParam

packages/query-core/src/infiniteQueryBehavior.ts:175–182  ·  view source on GitHub ↗

* 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>,
)

Source from the content-addressed store, hash-verified

173 * `getPreviousPageParam` option.
174 */
175function 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.

Callers 1

hasPreviousPageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected