fix(web): multi-PR badges open the linked pull requests panel (#13211)

This commit is contained in:
oliver authored and GitHub committed 2026-09-29 21:40:55 -03:00
1 parent 2a23c30ea6
commit 0fcd5f9061
4 files changed
+19 -17

No files matched your search

@@ -793,7 +793,7 @@ export function BranchToolbarBranchSelector({
number={prNumber}
url={prUrl}
status={displayedPrStatus}
onOpenStack={() => useRightPanelStore.getState().open(threadRef, "pull-requests")}
onOpenList={() => useRightPanelStore.getState().open(threadRef, "pull-requests")}
onOpenPullRequest={(event) => {
if (prUrl) openPrLink(event, prUrl);
}}
+4 -3
View File
@@ -1515,11 +1515,12 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
const accessibleTitle = isRenaming ? null : <span className="sr-only">{thread.title}</span>;
// Stacks show their layer count; multiple unrelated links show their total count.
// Plain clicks open T3; individual PR links also support opening the host in a new tab.
// Either opens the thread's pull requests tab; a single PR link opens that PR and still
// supports opening the host in a new tab.
const prBadgeShape = supportsMultiplePullRequests
? resolveThreadPullRequestBadge(thread.pullRequests)
: null;
const handlePrStackClick = useCallback(() => {
const handlePrListClick = useCallback(() => {
useRightPanelStore.getState().open(threadRef, "pull-requests");
if (!props.isActive) onThreadActivate(threadRef);
}, [onThreadActivate, props.isActive, threadRef]);
@@ -1531,7 +1532,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
number={pr?.number ?? currentLinkedPr?.number}
url={pr?.url ?? currentLinkedPr?.url}
status={prStatus}
onOpenStack={handlePrStackClick}
onOpenList={handlePrListClick}
onOpenPullRequest={handlePrClick}
/>
) : null;
@@ -195,7 +195,8 @@ export function resolveThreadPullRequestBadgePresentation({
* The linked-PR badge shared by the sidebar and composer footer. The badge owns what it shows:
* the state glyph and number at the meta size, in the state's color. The caller owns the control
* it sits in through `render` (an inline link in a sidebar row, a toolbar control in the
* composer), and the badge fills in the link or stack button behavior.
* composer), and the badge fills in the behavior: a single PR is a link to it, while a stack or
* several linked PRs is a button that opens the thread's pull requests tab.
*/
export function ThreadPullRequestBadgeControl({
render,
@@ -203,7 +204,7 @@ export function ThreadPullRequestBadgeControl({
number,
url,
status,
onOpenStack,
onOpenList,
onOpenPullRequest,
}: {
render: ReactElement<{ render?: useRender.RenderProp }>;
@@ -211,7 +212,7 @@ export function ThreadPullRequestBadgeControl({
number?: number | undefined;
url?: string | undefined;
status: PrStatusIndicator | null;
onOpenStack: () => void;
onOpenList: () => void;
onOpenPullRequest: (event: MouseEvent<HTMLElement>) => void;
}) {
const presentation = resolveThreadPullRequestBadgePresentation({ badge, number, url, status });
@@ -220,9 +221,9 @@ export function ThreadPullRequestBadgeControl({
<PullRequestBadge
render={render}
presentation={presentation}
isStack={badge?.kind === "stack"}
opensList={badge !== null && (badge.kind === "stack" || badge.others > 0)}
url={url}
onOpenStack={onOpenStack}
onOpenList={onOpenList}
onOpenPullRequest={onOpenPullRequest}
/>
);
@@ -231,26 +232,26 @@ export function ThreadPullRequestBadgeControl({
function PullRequestBadge({
render,
presentation,
isStack,
opensList,
url,
onOpenStack,
onOpenList,
onOpenPullRequest,
}: {
render: ReactElement<{ render?: useRender.RenderProp }>;
presentation: NonNullable<ReturnType<typeof resolveThreadPullRequestBadgePresentation>>;
isStack: boolean;
opensList: boolean;
url: string | undefined;
onOpenStack: () => void;
onOpenList: () => void;
onOpenPullRequest: (event: MouseEvent<HTMLElement>) => void;
}) {
const onClick = isStack
const onClick = opensList
? (event: MouseEvent<HTMLElement>) => {
event.preventDefault();
event.stopPropagation();
onOpenStack();
onOpenList();
}
: onOpenPullRequest;
const element = isStack ? (
const element = opensList ? (
<button type="button" />
) : (
<a href={url} target="_blank" rel="noopener noreferrer" />
+1 -1
View File
@@ -164,7 +164,7 @@ on the Pull Requests page, **Link to thread** lets you search for an active thre
also lists the threads that link to it, including archived threads, so you can return to their context.
Thread badges show a stack's layer count or the current review number with a count of additional
links. On mobile, the Git overview lists linked reviews and their stacks; tap a review to open it.
links. Clicking a badge with more than one review opens the **Linked pull requests** panel. On mobile, the Git overview lists linked reviews and their stacks; tap a review to open it.
Linking and unlinking are available in the web and desktop clients.
The **Linked pull requests** panel lists every review and groups stacks. Unlink a review from its