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

[SERVICES-2466] Fix 'hasPreviousPage' field on paginated queries #1375

Conversation

mad2sm0key
Copy link
Contributor

@mad2sm0key mad2sm0key commented Jun 19, 2024

Reasoning

  • the hasPreviousPage field of the PageInfo model on paginated queries is always false

Proposed Changes

  • override the values provided by the util function connectionFromArraySlice from the graphql-relay package

How to test

A paginated query (filteredTokens / filteredPairs / filteredStakingFarms) using forward cursor pagination like below, should correctly return true for the hasPreviousPage field

query {
  filteredTokens(
    filters:{}
    pagination:{
      first:10
      after:"YXJyYXljb25uZWN0aW9uOjk="
    }
  ) {
    edges {
      cursor
      node {
        identifier
        price
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
    pageData {
      count
      limit
      offset
    }
  }
}

@cfaur09
Copy link

cfaur09 commented Jun 20, 2024

tested 🟢

@mad2sm0key mad2sm0key merged commit 7466178 into development Jun 20, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants