Skip to content
module@warp-drive/core/signals/-leaked

Interface PageCache<RT, E> sincev5.9.0

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:69

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:

ts
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

ts
firstLink: string | null;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:93

The first link of the collection, when the response exposed one.


ts
lastLink: string | null;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:96

The last link of the collection, when the response exposed one.


ts
nextLink: string | null;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:90

The next link of this page, or null at the end of the collection.


pageNumber

ts
pageNumber: number;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:103

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.


ts
prevLink: string | null;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:87

The prev link of this page, or null at the start of the collection.


request

ts
request: Future<RT> | null;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:78

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.


ts
selfLink: string | null;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:84

The self link of this page — the URL that identifies it in the collection.

data

Get Signature

ts
get data(): ContentData<RT> | null;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:130

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

ts
get first(): PageCache<RT, E> | null;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:195

The first page of the collection, when the response exposed a first link.

Returns

PageCache<RT, E> | null


isCancelled

Get Signature

ts
get isCancelled(): boolean;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:163

Whether this page's request was cancelled (aborted).

Returns

boolean


isError

Get Signature

ts
get isError(): boolean;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:169

Whether this page's request rejected with an error.

Returns

boolean


isLoaded

Get Signature

ts
get isLoaded(): boolean;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:145

Whether this page's request has settled (successfully or with an error).

Returns

boolean


isLoading

Get Signature

ts
get isLoading(): boolean;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:151

Whether this page's request is currently in flight.

Returns

boolean


isRequested

Get Signature

ts
get isRequested(): boolean;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:139

Whether a request has ever been issued for this page. false for pages that are known only from links.

Returns

boolean


isSuccess

Get Signature

ts
get isSuccess(): boolean;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:157

Whether this page's request resolved successfully.

Returns

boolean


last

Get Signature

ts
get last(): PageCache<RT, E> | null;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:202

The last page of the collection, when the response exposed a last link.

Returns

PageCache<RT, E> | null


next

Get Signature

ts
get next(): PageCache<RT, E> | null;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:188

The page at this page's next link, or null at the end of the collection.

Returns

PageCache<RT, E> | null


prev

Get Signature

ts
get prev(): PageCache<RT, E> | null;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:181

The page at this page's prev link, or null at the start of the collection.

Returns

PageCache<RT, E> | null


reason

Get Signature

ts
get reason(): 
  | StructuredErrorDocument<E>
  | null;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:175

The error this page's request rejected with, or null if it did not reject.

Returns

| StructuredErrorDocument<E> | null


value

Get Signature

ts
get value(): RT | null;

Defined in: warp-drive-packages/core/src/signals/page-cache.ts:121

The document this page's request resolved to, or null while it has not resolved.

Returns

RT | null

Released under the MIT License.