0

I'm following the Hasura documentation on GraphQL Limit and Offset for pagination, and I noticed something that seems incorrect.

The docs state:

"If we have 50 todos, we could split them into 5 pages of 10 todos. You would fetch the first page as follows:"

Then, they provide this query:

{
  todos(limit: 5, offset: 0) {
    title
    is_completed
    is_public
  }
}

However, this query actually returns 5 todos per page, not 10. If repeated with increasing offset, it would produce 10 pages of 5 todos each, not 5 pages of 10 todos as the documentation claims.

My Understanding

  • If we need 5 pages of 10 todos each, the query should be:
    {
      todos(limit: 10, offset: 0) {
        title
        is_completed
        is_public
      }
    }
    
    And for Page 2:
    {
      todos(limit: 10, offset: 10) {
        title
        is_completed
        is_public
      }
    }
    

Question:

Am I misunderstanding how Hasura handles limit and offset, or is this indeed a documentation error? Would appreciate any clarification! 🚀


0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.