Unknown argument “hasNextPage” on field “pageInfo” GraphQL

Unknown argument “hasNextPage” on field “pageInfo” GraphQL


0

How to implement pagination for graphQL Query? I keep receiving:

"message": "Unknown argument "hasNextPage" on field "pageInfo" of type "Core_EventPeopleConnection"."

query myquery($viewId: ID!,$hasNextPage: Boolean!, $endCursor: String!){
  Core_eventPeopleListView(viewId: $viewId){
    id
    people{
      pageInfo(hasNextPage: true,endCursor: $endCursor){
        hasNextPage
        endCursor
      }
     nodes{
      firstName
      lastName
      jobTitle
      organization
      websiteUrl
    } 
    }
    }    
    }
Variables:
        {
      "viewId":"RXZlbnRWaWV3XzMyMTY1Mw==",
      "endCursor": "WyJhZ2Fyd2FsIiwic2hydXRpIiwiUlhabGJuUlFaVzl3YkdWZk1UVXhPREkzTlRVPSJd",
      "hasNextPage": true
    }

1 Answer
1


1

In Relay specification, hasNextPage is not an argument, but a field that is returned from the API to tell you if you can paginate further. Just remove the argument:

query myquery($viewId: ID!,$hasNextPage: Boolean!, $endCursor: String!){
  Core_eventPeopleListView(viewId: $viewId){
    id
    people{
      pageInfo(endCursor: $endCursor){
        hasNextPage
        endCursor
      }
      nodes{
        firstName
        lastName
        jobTitle
        organization
        websiteUrl
      } 
    }
  }    
}



Leave a Reply

Your email address will not be published. Required fields are marked *