-
Notifications
You must be signed in to change notification settings - Fork 860
HasPreviousPage is always false #2737
Comments
HasPreviousPage is always false if you are paging forwards |
does this link answer my problem ? |
Same problem here, running on 1.11.0. |
@salim-dev please provide more information, the following is not clear (also compare to the bug report template):
Thanks! |
Will most likely get back at this in the afternoon and provide a clearer description. I think what we assume is an error might be intended behavior. |
Sorry, didn't find the time so far. The A simple example where you have a list of 5 posts (ids "1"-"5") in the database and query
We might only want to show 2 items at a time with forward & back buttons. The What is expected is instead this:
The same problem occurs when paginating backwards using The relay spec states:
Therefore i assume this could be handled as a feature request. A feature, i might add, that would be very helpful because basic bi-directional windowed pagination can not be performed satisfyingly at the moment. |
Thanks a lot for that detailed description @codepunkt. I'm closing this issue as it's not a bug. Thanks @codepunkt @salim-dev! |
Done at #2765 |
Query :
PostsConnection(first:3, after: "cjhabyv7j002h0924alphj8rw"){
pageInfo{hasNextPage hasPreviousPage startCursor endCursor}
edges {node{
id
title
}
aggregate{count}
}
output:
{
"data": {
"setsConnection": {
"pageInfo": {
"hasNextPage": true,
"hasPreviousPage": false
"startCursor": "cjhabyv89002l09240y3rts33",
"endCursor": "cjhabyvaa002t0924vkgydelt"
},
"edges": [
{
"node": {
"id": "cjhabyv89002l09240y3rts33",
"title": "Title 10"
}
},
{
"node": {
"id": "cjhabyv9f002p09242pyuqecg",
"title": "Title 11"
}
},
{
"node": {
"id": "cjhabyvaa002t0924vkgydelt",
"title": "Title 12"
}
},
],
"aggregate": {
"count": 18
}
}
}
}
datamodel :
type Post {
id: ID!
createdAt: DateTime!
updatedAt: DateTime!
title: String!
content: String!
author: User!
isPublished: Boolean @default(value: false)
}
type User {
id: ID!
role: ROLE @default(value: CONTRIBUTOR)
createdAt: DateTime!
updatedAt: DateTime!
posts: [Post!]
}
enum ROLE {
ADMIN
EDITOR
CONTRIBUTOR
}
Versions (please complete the following information):
prisma
CLI: prisma/1.11.0The text was updated successfully, but these errors were encountered: