ApiV2-GraphQL-Docs icon indicating copy to clipboard operation
ApiV2-GraphQL-Docs copied to clipboard

pageInfo.lastPage returns incorrect value on activity queries when using certain filters

Open ben-hig opened this issue 5 years ago • 1 comments

The use of some filters on activities queries results in the lastPage value of pageInfo returning as 537798. The actual results of each page appear to be correct, with pages past the actual result set returning no results.

The two filters that I have experience this issue with are userId_in and mediaId_in so it may have something to do with "in" filters. Here are some example queries that currently experience this issue:

First query:

{
  Page(page: 1) {
    pageInfo {
      lastPage
    }
    activities(type: TEXT, userId_in: [118727, 112350]) {
      ... on TextActivity {
        id
        text
      }
    }
  }
}

Second query:

query ($page: Int, $userId: Int, $mediaIds: [Int]) {
  Page(page: $page) {
    pageInfo {
      lastPage
    }
    activities(userId: $userId, mediaId_in: $mediaIds) {
      ... on ListActivity {
        id
        status
        progress
        createdAt
        media {
          title {
            romaji
            english
          }
          type
          episodes
          chapters
        }
      }
    }
  }
}

with variables:

{
  "page":1,
  "userId":118727,
  "mediaIds": [
    21699, 21776, 21403, 21878, 21400, 87496, 21731, 21856, 20958, 21517, 21377, 97917, 97986, 21875, 98291, 21745, 98491, 98884, 98885, 99255, 99726, 20791, 98108
  ]
}

ben-hig avatar Oct 06 '20 00:10 ben-hig

It's been quite some time since I first discovered this issue, and I'm surprised to see that the value for lastPage has remained unchanged after all this time, and is still 537798 for both queries. My original suspicion was that it was returning the lastPage as if there were no filters (so the amount of pages of ALL activities), but since the number hasn't changed after over 10 months, it kind of seems like it's just been hardcoded somewhere and forgotten

ben-hig avatar Aug 26 '21 03:08 ben-hig