Skip to main content
Version: v10.0.0

relayConnection

Reads the rows and the next cursor of a Relay connection ( edges / node ), for a paginated GraphQL loader. Spread it into the loader options and add page to send the cursor.


Import
import { relayConnection } from "@hyper-fetch/db"

Usage​

collection(PostSchema, { key: "id" }).load(getPosts, {
...relayConnection((response: PostsResponse) => response.posts),
page: (after) => ({ payload: { after } }),
});

Parameters​

relayConnection<Response, Node>(select: (response: Response) => RelayConnection<Node>)
Parameters
NameTypeDescription
select
(response: Response) => RelayConnection<Node>

Returns​

relayConnection
NameTypeDescription
cursor
(response: Response) => null | string
rows
(response: Response) => Node[]