Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphQL blocks pagination on stake pool not working as expected #1204

Closed
lewnelson opened this issue Nov 26, 2019 · 0 comments · Fixed by #1205
Closed

GraphQL blocks pagination on stake pool not working as expected #1204

lewnelson opened this issue Nov 26, 2019 · 0 comments · Fixed by #1205
Assignees
Labels
A-explorer Area: Explorer API and backend bug Something isn't working

Comments

@lewnelson
Copy link

Pagination on the blocks returned from stake pools in GraphQL aren't working as expected. When querying with the (last:10) parameters only 9 blocks are being returned. However when querying with (before:"n", last:10), 10 blocks are returned. This is true for stake pools with 10 or more blocks.

Mandatory Information

  1. jcli --full-version - jcli 0.7.2 (HEAD-b5df0e0, release, macos [x86_64]) - [rustc 1.39.0 (4560ea788 2019-11-04)]
  2. jormungandr --full-version - jormungandr 0.7.2 (HEAD-b5df0e0, release, macos [x86_64]) - [rustc 1.39.0 (4560ea788 2019-11-04)]

To Reproduce
Steps to reproduce the behavior:

Query which fails to return 10 blocks (note this stake pool contains "721" blocks). Only the latest 9 blocks are being returned. (effectively page 1)

{
  stakePool(id: "3054189da4f1b98546c75a28e1f5f4b7f3d96a5656cf1092eb6f41bfd01d1097") {
    blocks(last: 10) {
      pageInfo {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
      totalCount
      edges {
        cursor
        node {
          id
        }
      }
    }
  }
}

This query returns 10 blocks. (effectively page 2)

{
  stakePool(id: "3054189da4f1b98546c75a28e1f5f4b7f3d96a5656cf1092eb6f41bfd01d1097") {
    blocks(last: 10, before:"711") {
      pageInfo {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
      totalCount
      edges {
        cursor
        node {
          id
        }
      }
    }
  }
}

Expected behavior
Expecting 10 blocks to return when asked for 10 blocks and the stake pool contains at least 10 blocks.

Additional context
Add any other context about the problem here.

@ecioppettini ecioppettini self-assigned this Nov 26, 2019
@ecioppettini ecioppettini added A-explorer Area: Explorer API and backend bug Something isn't working labels Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-explorer Area: Explorer API and backend bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants