Use GitHub's GraphQL service to fetch PR details #325
Labels
Difficulty/2:Medium
Medium ticket
Hacktoberfest
Help Wanted
Community help wanted
Tech/Go
Tech/ReactJS
Type/Enhancement
New feature or improvement of existing feature
Up For Grabs
Ready for help from the community. Removed when someone volunteers
As noted in #170 (comment) , we are making 3 API calls to GitHub's REST API for each PR when we want to display detailed info about each PR in the RHS. Using GitHub's GraphQL API, we can ideally fetch all information in one request.
We can use GitHub's GraphQL explorer to test queries:
https://developer.github.com/v4/explorer
Here is an example query that fetches some of the required data:
One strategy would be to:
This is the same basic logic as it currently works, but I think if the backend takes care of the "PR details" logic, the frontend can just say "give me all data I need for this category", the backend can use one GraphQL query without worrying about which specific PR IDs need the details etc. That's taken care of by GitHub in the query.
We can compose queries using https://github.com/shurcooL/githubv4 , which is a Go driver for GitHub's GraphQL service. Much of the querying logic has overlap between the categories, so there should be an opportunity to reuse the querying logic with the structures we create with this library. This is useful for performing the "all-in-one" query versus the "one category" query.
A couple things to note:
The text was updated successfully, but these errors were encountered: