highlight-non-default-base-branch - Simplify query#9168
Merged
fregante merged 2 commits intoApr 7, 2026
Merged
Conversation
…m the same query Removes the parallel `getDefaultBranch()` call and the `buildRepoUrl()` helper. The default branch and `nameWithOwner` are now fetched in the same GraphQL query that already retrieves the PRs' base refs, eliminating the second HTTP request and the DOM-based repo lookup. Refs refined-github#9167
fregante
approved these changes
Apr 7, 2026
highlight-non-default-base-branch - Get default branch and repo from the same queryhighlight-non-default-base-branch - Simplify query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #9167
Per @fregante's suggestion in #9167, this is a small refactor that prepares the feature for follow-up work without changing its scope or behavior:
getDefaultBranch()call. The default branch is now fetched asdefaultBranchRef { name }inside the samerepository()query that already gets the PRs' base refs, so each batch makes one HTTP request instead of two.buildRepoUrl()helper call. The base-branch tree URL is now built fromnameWithOwnerreturned by the same query, dropping the DOM-based repo lookup.No user-visible change. The feature still only runs on per-repo issue/PR lists. A follow-up PR will extend it to the global PR/issue list now that each batch is self-contained and doesn't depend on the current page's repo.
Test URLs
https://github.com/refined-github/sandbox/pulls?q=is%3Apr+is%3Aopen+pr+branch
Screenshot
(no visual change — same badge as before)