graphql-dotnet / graphql-dotnet/relay

pageInfo.hasPreviousPage always false when forward-paginating

Open
#22 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
74
Forks
28
PR merge metrics
No merged PRs in 30d

Description

When using forward pagination (first+after), `pageInfo.hasPreviousPage` always returns `false`.

The logic for calculating `hasNextPage`/`hasPreviousPage` is found in https://github.com/graphql-dotnet/relay/blob/4a1f9352f65c057684bac5ba020468956a93440d/src/GraphQL.Relay/Types/ArraySliceMetrics.cs#L47-L75

Is this behavior intentional? Consider this query:
```
query {
something(first:10 after:'SOMECURSOR') {
pageInfo {
startCursor
hasPreviousPage
}
}
}
```

I would expect `hasPreviousPage` to be true IFF `something(last:X before:startCursor)` returns any results. However, it's always `false`.

The same goes for `hasNextPage` during backwards pagination, of course.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.