Skip to content
API/fetchQubeePage()

fetchQubeePage()

function
src/utils/fetch-qubee-page.ts2 parameters

Fetch one page of a list and parse it with the driver that built the request.

It sends the request’s headers — the page, for drivers that paginate through headers — hands the response headers to the parser, and returns a plain object: it can be cached, compared, and passed from a Server Component to a Client Component.

This is the one function of the package that performs I/O. It runs anywhere: in a Server Component, a route loader, a script, or under the fetching hooks, which all call it.

import { fetchQubeePage } from '@qubeejs/react/fetch';
function fetchQubeePage<T extends object>(request: ListRequest, options: { … }): Promise<PaginatedResult<T>>
Parameter Type Description
request ListRequest What to fetch: list.request from useQubeeList, or core’s buildListRequest()
options { … } fetcher: what performs the request, the global fetch by default; signal: aborts it

The rows and the page metadata, as core’s toPlain() returns them

const request = buildListRequest(articleList, readListState(articleList, await searchParams));
const page = await fetchQubeePage<Article>(request);

QubeeFetcher