Skip to content

highlight-non-default-base-branch - Support global PR/issue lists#9170

Merged
fregante merged 18 commits into
refined-github:mainfrom
SeongJaeSong:highlight-non-default-base-branch-global
Apr 16, 2026
Merged

highlight-non-default-base-branch - Support global PR/issue lists#9170
fregante merged 18 commits into
refined-github:mainfrom
SeongJaeSong:highlight-non-default-base-branch-global

Conversation

@SeongJaeSong
Copy link
Copy Markdown
Contributor

@SeongJaeSong SeongJaeSong commented Apr 7, 2026

Closes #9167. Follow-up to #9168.

Extends the feature to the global PR/issue dashboards (/pulls, /issues, /pulls?author=@me, etc.) where the badge is arguably most useful — that's where you scan PRs across many repos and have no other quick way to spot one targeting a non-default branch.

What changed

  • Added pageDetect.isGlobalIssueOrPRList to include.
  • Added the React row selector (a[data-testid="issue-pr-title-link"][href*="/pull/"]) used by the global lists, alongside the existing legacy selector.
  • Each PR's owner/repo/number is parsed from its href, so the feature no longer assumes a single-repo page context.
  • buildQuery now emits one aliased repository(owner, name) { ... } block per repo, all in a single GraphQL query.
  • Badge insertion: legacy rows still use the existing metadata container; React rows (no stable container yet) get the badge placed right after the title link.

Why grouping by repo into a single query:

Sending one query per PR (or per repo, in parallel) would be simpler, but I went with single-query alias grouping to be safe against GitHub's secondary rate limits — the global PR list can easily contain PRs from 10+ distinct repos, and the per-request limit (and burst limit) is much tighter than the points budget. One batched query also saves a round trip and keeps response handling sequential. The added complexity is contained to buildQuery + alias lookup in add.

If you'd rather have the simpler version (one api.v4 call per repo, in parallel), happy to switch.

Test URLs

Screenshot

Per-repo

image

Global PR list

image

@SeongJaeSong SeongJaeSong changed the base branch from main to sandbox/keep-branch April 7, 2026 12:55
@SeongJaeSong SeongJaeSong changed the base branch from sandbox/keep-branch to main April 7, 2026 12:56
@SeongJaeSong SeongJaeSong marked this pull request as ready for review April 7, 2026 13:00
Comment thread source/features/highlight-non-default-base-branch.tsx Outdated
Comment thread source/features/highlight-non-default-base-branch.tsx Outdated
Comment thread source/features/highlight-non-default-base-branch.tsx Outdated
Copy link
Copy Markdown
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be ok now. Thank you!

@fregante fregante requested a review from SunsetTechuila April 12, 2026 19:09
Comment thread source/features/highlight-non-default-base-branch.tsx Outdated
Copy link
Copy Markdown
Member

@SunsetTechuila SunsetTechuila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making changes

Comment thread source/features/highlight-non-default-base-branch.tsx Outdated
Comment thread source/features/highlight-non-default-base-branch.tsx Outdated
Comment thread source/features/highlight-non-default-base-branch.tsx Outdated
Comment on lines +123 to +127
observe([
'.js-issue-row a[data-hovercard-type="pull_request"]', // Repo and global PR lists
'a[data-hovercard-type="pull_request"][data-testid="listitem-title-link"]', // Preview global PR list
'a[data-hovercard-type="pull_request"][data-testid="issue-pr-title-link"]', // Issue list
], batchedFunction(add, {delay: 100}), {signal});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SunsetTechuila see last commit. While :is feels like an optimization (DRY) it actually makes it difficult to:

  • read each selector (especially if it varies with * sometimes and sometimes not)
  • modify each selector in the future in cases where the root is has to be changed

If the common selector is super long, we could use replacement to preserve readability while keeping it DRY:

  const link = 'a[data-hovercard-type="pull_request"]'
	observe([
		`.js-issue-row ${link}`, // Repo and global PR lists
		`${link}[data-testid="listitem-title-link"]`, // Preview global PR list
		`${link}[data-testid="issue-pr-title-link"]`, // Issue list
	], batchedFunction(add, {delay: 100}), {signal});

but this is also not without issues

@fregante fregante merged commit 7ff5e1b into refined-github:main Apr 16, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

highlight-non-default-base-branch doesn't run on global PR/issue lists (/pulls, /issues)

3 participants