According to the Relay spec:
PageInfo must contain fields hasPreviousPage and hasNextPage, both of which return non‐null booleans. It must also contain fields startCursor and endCursor, both of which return non‐null opaque strings.
But in
|
const endCursor = edges[edges.length - 1] && edges[edges.length - 1].cursor; |
, we don't return an appropriate fallback if the cursor is null (which happens when the query returns no results). This may (?) cause issues when integrating with Relay, but more importantly, isn't spec-compliant.
I think the appropriate fix (and I might take this on myself with a little more time) is to fall back to the cursor provided in the arguments (i.e. first or last)—these could be re-used by a client to request the theoretical 'next' page, should one become available between requests.
According to the Relay spec:
But in
apollo-cursor-pagination/src/builder/index.js
Line 161 in 2552dfe
I think the appropriate fix (and I might take this on myself with a little more time) is to fall back to the cursor provided in the arguments (i.e.
firstorlast)—these could be re-used by a client to request the theoretical 'next' page, should one become available between requests.