Interface PageCache<RT = unknown, E = unknown> sincev5.9.0
interface PageCache<RT = unknown, E = unknown> {
firstLink: string | null;
lastLink: string | null;
nextLink: string | null;
pageNumber: number;
prevLink: string | null;
request: Future<RT> | null;
selfLink: string | null;
get data(): ContentData<RT> | null;
get first(): PageCache<RT, E> | null;
get isCancelled(): boolean;
get isError(): boolean;
get isLoaded(): boolean;
get isLoading(): boolean;
get isRequested(): boolean;
get isSuccess(): boolean;
get last(): PageCache<RT, E> | null;
get next(): PageCache<RT, E> | null;
get prev(): PageCache<RT, E> | null;
get reason(): StructuredErrorDocument<E> | null;
get value(): RT | null;
}Hideconstructor
A single page of a paginated collection: its request, its loaded document, and its links to neighboring pages in the shared page graph.
Pages are yielded to consumers as Readonly<PageCache> — through PaginationState.activePage, PaginationState.pages, and the relational getters below — to read a page's data and request status when building pagination UIs:
const page = paginationState.activePage;
if (page?.isLoading) {
// show a spinner
} else if (page?.isError) {
// show page.reason
} else {
// render page.data
}Type Parameters
RT
RT = unknown
E
E = unknown
Properties
firstLink
firstLink: string | null;The first link of the collection, when the response exposed one.
lastLink
lastLink: string | null;The last link of the collection, when the response exposed one.
nextLink
nextLink: string | null;The next link of this page, or null at the end of the collection.
pageNumber
pageNumber: number;The 1-based page number, or 0 when unknown (for example cursor-based pagination, where pages have no ordinal position). Derived from the collection's PageHints.
prevLink
prevLink: string | null;The prev link of this page, or null at the start of the collection.
request
request: Future<RT> | null;The request that loaded (or is loading) this page, or null if the page is known from links but was never requested. Wrap it in a <Request> component to render the page's loading, error, and content states.
selfLink
selfLink: string | null;The self link of this page — the URL that identifies it in the collection.
data
Get Signature
get data(): ContentData<RT> | null;The data member of the loaded document — the page's items — or null while the page has not loaded.
Returns
ContentData<RT> | null
first
Get Signature
get first(): PageCache<RT, E> | null;The first page of the collection, when the response exposed a first link.
Returns
PageCache<RT, E> | null
isCancelled
Get Signature
get isCancelled(): boolean;Whether this page's request was cancelled (aborted).
Returns
boolean
isError
Get Signature
get isError(): boolean;Whether this page's request rejected with an error.
Returns
boolean
isLoaded
Get Signature
get isLoaded(): boolean;Whether this page's request has settled (successfully or with an error).
Returns
boolean
isLoading
Get Signature
get isLoading(): boolean;Whether this page's request is currently in flight.
Returns
boolean
isRequested
Get Signature
get isRequested(): boolean;Whether a request has ever been issued for this page. false for pages that are known only from links.
Returns
boolean
isSuccess
Get Signature
get isSuccess(): boolean;Whether this page's request resolved successfully.
Returns
boolean
last
Get Signature
get last(): PageCache<RT, E> | null;The last page of the collection, when the response exposed a last link.
Returns
PageCache<RT, E> | null
next
Get Signature
get next(): PageCache<RT, E> | null;The page at this page's next link, or null at the end of the collection.
Returns
PageCache<RT, E> | null
prev
Get Signature
get prev(): PageCache<RT, E> | null;The page at this page's prev link, or null at the start of the collection.
Returns
PageCache<RT, E> | null
reason
Get Signature
get reason(): StructuredErrorDocument<E> | null;The error this page's request rejected with, or null if it did not reject.
Returns
StructuredErrorDocument<E> | null
value
Get Signature
get value(): RT | null;The document this page's request resolved to, or null while it has not resolved.
Returns
RT | null