graphqlhub icon indicating copy to clipboard operation
graphqlhub copied to clipboard

How does limit work?

Open felixsanz opened this issue 9 years ago • 1 comments

In the code:

      resolve(repo, { limit }) {
        return getIssuesForRepo(repo.owner.login, repo.name).then((issues) => {
          if (limit) {
            return issues.slice(0, limit);
          }
          return issues;
        });
      }

Looks like you ask the api for ALL the issues and then slice? Isn't that too much overload? I'm trying to learn graphql.

Thanks for the repo and the blog posts

felixsanz avatar Mar 31 '16 04:03 felixsanz

Good call, this is broken - it looks like the proper way to deal with getting "all" issues (and/or limiting) is using page and per_page query params (i.e. React's issues)

If you'd like to take a shot at a PR for this, that would be awesome! Exposing Github's underlying API would be a good start (i.e. using page directly) and would fix the current bug, but wrapping these in a Relay-friendly cursor API is where I hope it would get to eventually

clayallsopp avatar Mar 31 '16 15:03 clayallsopp