Closed dotslashbit closed 2 weeks ago
Checked response data. It is fetching data for has_pull_request = true/false both.
Yes but what we want to know is whether it's a open pr or draft or close
@dotslashbit @sanketmn26 I was able to retrieve the PR state from the graphql query. Are you currently working on this? I May submit a PR here shortly.
I also found a response with PR: True
and state: null
maybe I am doing something wrong here? In this case when I checked, it had no open, draft, or closed PRs for the issue... Is this a github API thing?
@sanketmn26 @Sechorda
We are using graphql queries and in the docs I found this --> https://docs.github.com/en/graphql/reference/objects#pullrequest
It basically says that every Pr has a closed boolean, so intuitively what I'm thinking is, lets keep the existing queries as is. After fetching all the issues , we can run a query by providing the the Pr object and check its closed value if its closed then we can count it as the issue associated with the current Pr doesn't have any PRs.
Do you get it? If you have any other idea, do let me know
We can take time on this, its not that big of a deal but this will make sure we are giving the best results possible to the user
@dotslashbit I think I know what you mean, but don't exactly follow. My brain went this way:
Include the PR state in the query, resulting in still only one query. Filter issues base on PR state status with the logic that if it's open, draft, closed, or null (saw some null edge cases) then it returns the issue to the user.
const filteredIssues = issues.filter(issue => { if (!params.hasPullRequests) { return !issue.has_pull_requests; } else { return issue.has_pull_requests && (issue.pr_status === 'OPEN' || issue.pr_status === 'DRAFT' || issue.pr_status === 'CLOSED' || issue.pr_status === null); } });
@Sechorda I get it, but is the query working? If it's working then your way is a better solution
@dotslashbit the PR draft I submitted has a working query and filter based on the requested PR state logic. Double check me though!
Marked PR draft as ready for review
@Sechorda sure will do that later, thank you so much
@dotslashbit woot
@dotslashbit @Sechorda There was a bug in below statement.
We were not importing "nodes" data in query. So when "timelineItems.totalCount > 0 === true". It was throwing error because It could not find "timelineItems.nodes"
Please have a look.
@sanketmn26 are you getting an error in the web app or in dev mode. Also have you updated your local setup
@dotslashbit I was getting error in dev mode in local setup. But not after adding nodes in query.
@sanketmn26 update your local code, cause I checked on my laptop and it's working perfectly fine
Update your GitHub fork and then do the following
Just do a git pull origin main
from your main branch and then run it
Currently the api query fetches issues with closed PRs only when hasPR is checked. We need to update the query so that it'll fetch:
If you want to work on this, please comment below. If you need any help, just ping me, I can help you with this, thanks