Skip to content

How To: Enable Bidirectional Pagination to Fix has*Page Always Being False for the Reverse Direction

Trevor Turk edited this page Jul 11, 2018 · 1 revision

You may notice that Connections based on GraphQL::Types::Relay::BaseConnection always return false for pageInfo { hasPreviousPage } or pageInfo { hasNextPage } depending on which direction you're paginating.

According to #960 you can adjust the behavior like so:

GraphQL::Relay::ConnectionType.bidirectional_pagination = true

Note: "This will become the default behavior in a future graphql-ruby version. (But it is not the default behavior now because it has performance implications.)"