`first` and `last` arguments for FollowerConnection don't work as intended

schema-request

#1

To get the last 10 followers of user:

{
  user(login: "octocat") {
    followers(last: 10) {
      totalCount
      edges {
        node {
          login
        }
      }
    }
  }
}

The returned result doesn’t actually contain the last (the newest) 10 followers.

GistConnection seems to be fine.

{
  user(login: "octocat") {
    gists(first: 5) {
      edges {
        node {
          name
          pushedAt
        }
      }
    }
  }
}

#2

:wave: @HenryQW ,

I took a quick look at this and it seems to be working as expected for me, could you describe the problem you see more?

When I use first: 10 I see the 10 first of the list,last:10 giving me the last 10 in the list etc. (not to be confused with order / direction)


#3

Hi thanks for the reply.

My intention was to get the last (the newest) or the first (the oldest) 10 followers, something like a descending/ascending order by follow time. See GirHub follower tab: https://github.com/octocat?tab=followers

For gists, both last:10 and first:10 will return the newest/oldest results, but that’s not the case for followers.


#4

Gotcha!

As far as I can see the ordering from the GraphQL query is the same as on the followers tab, doing first:10 gets the first 10 of that list for me. With that said, it probably wouldn’t hurt having a more explicit ordering here :thinking:

I’ve added this to our internal tracker and we’ll update this thread when we have some more information!


#5

It’s working for me now as well, for a period the results were ordered alphabetically. Thanks!


#6

oh, that’s weird! :thinking:

Please just drop a message here if you run into this again and I can take a closer look, and also open an internal ticket for investigation. :heart:


#7

yeah the first and last parameters seem to be inconsistent for different queries. For example:

{
  repository(owner: "octocat", name: "Spoon-Knife") {
    stargazers(last: 10) {
      edges {
        node {
          login
          avatarUrl
        }
      }
    }
  }
}

This will return the newest 10 stargazers with last: 10 in a reversed order appeared in the star tab.

For followers

{
  user(login: "octocat") {
    followers(first: 10) {
      edges {
        node {
          login
          avatarUrl
        }
      }
    }
  }
}

It requires first: 10 to get the newest 10 followers and the order is identical to the follower tab.

Not sure which one is the correct order designed but the latter looks more logical to me.


#8

I’ve added this to the internal ticket as well! :heart: