Closed
Description
According to this reply, there is a bug in Relay Cursor Connections Specification
hasPreviousPage will be false if the client is not paginating with last
hasNextPage will be false if the client is not paginating with first
And the implementation here:
graphql-ruby/lib/graphql/relay/relation_connection.rb
Lines 19 to 25 in 756373a
So:
pageInfo.hasPreviousPage is always false when paging forwards, pageInfo.hasNextPage is always false when paging backwards
My env:
server side: graphql (1.5.5)
client side: react-relay@^0.10.0
My query to support pagination:
articles(first: $first, after: $afterCursor, last: $last, before: $beforeCursor)
when clicking next:
goToNextPage = () => {
this.props.relay.setVariables({
first: pageSize,
afterCursor: this.props.viewer.articles.pageInfo.endCursor,
last: null,
beforeCursor: null
});
};
when clicking previous:
goToPrevPage = () => {
this.props.relay.setVariables({
last: pageSize,
beforeCursor: this.props.viewer.articles.pageInfo.startCursor,
first: null,
afterCursor: null
});
};
Metadata
Metadata
Assignees
Labels
No labels