From 171850bcdbb1a1e03eaf05ed32a89070e6ff7e27 Mon Sep 17 00:00:00 2001 From: Connor Chevli Date: Thu, 6 Aug 2026 21:46:22 -0700 Subject: [PATCH] fix(web): relabel merged-PR quick action as "Merged" - Show "Merged" instead of "View PR" when the quick action targets a merged PR, since it now reads as a status chip rather than an action - Update tests to match the new label --- apps/web/src/components/GitActionsControl.logic.test.ts | 6 +++--- apps/web/src/components/GitActionsControl.logic.ts | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/web/src/components/GitActionsControl.logic.test.ts b/apps/web/src/components/GitActionsControl.logic.test.ts index e5ed6d0786b1..084ec5501cb1 100644 --- a/apps/web/src/components/GitActionsControl.logic.test.ts +++ b/apps/web/src/components/GitActionsControl.logic.test.ts @@ -104,17 +104,17 @@ describe("when: ref has a merged PR", () => { it("resolveQuickAction opens the merged PR when the ref is idle", () => { const quick = resolveQuickAction(status({ pr: mergedPr }), false); - assert.deepInclude(quick, { kind: "open_pr", label: "View PR", disabled: false }); + assert.deepInclude(quick, { kind: "open_pr", label: "Merged", disabled: false }); }); it("resolveQuickAction prefers viewing the merged PR over re-creating one after a squash merge", () => { const quick = resolveQuickAction(status({ pr: mergedPr, aheadOfDefaultCount: 2 }), false); - assert.deepInclude(quick, { kind: "open_pr", label: "View PR", disabled: false }); + assert.deepInclude(quick, { kind: "open_pr", label: "Merged", disabled: false }); }); it("resolveQuickAction opens the merged PR when the upstream ref is gone", () => { const quick = resolveQuickAction(status({ pr: mergedPr, hasUpstream: false }), false); - assert.deepInclude(quick, { kind: "open_pr", label: "View PR", disabled: false }); + assert.deepInclude(quick, { kind: "open_pr", label: "Merged", disabled: false }); }); it("resolveQuickAction still offers the commit flow for new changes", () => { diff --git a/apps/web/src/components/GitActionsControl.logic.ts b/apps/web/src/components/GitActionsControl.logic.ts index 0c2128273010..538747b5d087 100644 --- a/apps/web/src/components/GitActionsControl.logic.ts +++ b/apps/web/src/components/GitActionsControl.logic.ts @@ -224,6 +224,9 @@ export function resolveQuickAction( const isBehind = gitStatus.behindCount > 0; const isDiverged = isAhead && isBehind; const terminology = resolveChangeRequestTerminology(gitStatus); + // A merged PR still opens on click, but the label reports the state rather + // than the action - the purple tint and "Merged" read as one status chip. + const viewPrLabel = hasMergedPr ? "Merged" : `View ${terminology.shortLabel}`; if (!hasBranch) { return { @@ -252,7 +255,7 @@ export function resolveQuickAction( if (!gitStatus.hasUpstream) { if (!hasPrimaryRemote) { if ((hasOpenPr || hasMergedPr) && !isAhead) { - return { label: `View ${terminology.shortLabel}`, disabled: false, kind: "open_pr" }; + return { label: viewPrLabel, disabled: false, kind: "open_pr" }; } return { label: "Publish repository", @@ -262,7 +265,7 @@ export function resolveQuickAction( } if (!isAhead) { if (hasOpenPr || hasMergedPr) { - return { label: `View ${terminology.shortLabel}`, disabled: false, kind: "open_pr" }; + return { label: viewPrLabel, disabled: false, kind: "open_pr" }; } return { label: "Push", @@ -325,7 +328,7 @@ export function resolveQuickAction( // branch still reads as ahead of default, but re-creating a PR for commits // that already landed is never the right offer. if (hasOpenPr || hasMergedPr) { - return { label: `View ${terminology.shortLabel}`, disabled: false, kind: "open_pr" }; + return { label: viewPrLabel, disabled: false, kind: "open_pr" }; } if (hasDefaultBranchDelta && !isDefaultRef) {