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"
Source
Package
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
| Name | Type | Description |
|---|---|---|
| select | |
Returns
relayConnection
| Name | Type | Description |
|---|---|---|
| cursor | | |
| rows | |
