From 9b4dd6f30da94fce42b7349027753a050f5479f1 Mon Sep 17 00:00:00 2001
From: Alex Ross <38270282+alexr00@users.noreply.github.com>
Date: Wed, 7 Oct 2026 11:33:58 +0200
Subject: [PATCH] Fix wording for single PR stack Fixes
https://github.com/microsoft/vscode-pull-request-github/issues/9016.
---
webviews/components/pullRequestStack.tsx | 2 +-
webviews/editorWebview/test/overview.test.tsx | 23 ++++++++++++++++++-
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/webviews/components/pullRequestStack.tsx b/webviews/components/pullRequestStack.tsx
index d5fba43a44..c759adfc3d 100644
--- a/webviews/components/pullRequestStack.tsx
+++ b/webviews/components/pullRequestStack.tsx
@@ -72,7 +72,7 @@ export const StackSection = ({ pr }: { pr: PullRequest }) => {
{pr.state === GithubItemStateEnum.Open && openBelow > 0
? `Merging this pull request will also merge ${openBelow} pull request${openBelow === 1 ? '' : 's'} below it.`
- : `${stack.size} pull requests in this stack.`}
+ : `${stack.size} pull request${stack.size === 1 ? '' : 's'} in this stack.`}
{chevronDownIcon}
diff --git a/webviews/editorWebview/test/overview.test.tsx b/webviews/editorWebview/test/overview.test.tsx
index b8d4243c8d..ab3f6ad40b 100644
--- a/webviews/editorWebview/test/overview.test.tsx
+++ b/webviews/editorWebview/test/overview.test.tsx
@@ -248,6 +248,27 @@ describe('Overview', function () {
assert.strictEqual((out.getByText('Unstack all') as HTMLButtonElement).disabled, false);
});
+ it('uses singular wording for single-member stacks, including a retained merged PR', function () {
+ for (const state of [GithubItemStateEnum.Open, GithubItemStateEnum.Closed, GithubItemStateEnum.Merged]) {
+ const pr = new PullRequestBuilder().number(793).state(state).stack({
+ position: 1, size: 1, base: 'main',
+ pullRequests: [{
+ position: 1, number: 793, title: 'First Change', head: 'D1', url: 'https://example.com/793',
+ state, isDraft: false, mergeable: PullRequestMergeability.Unknown,
+ }],
+ }).build();
+ const out = render(
+
+
+ ,
+ );
+
+ assert.strictEqual(out.container.querySelector('.stack-description')?.textContent, '1 pull request in this stack.');
+ assert.strictEqual(out.container.querySelector('.stack-badge')?.textContent?.trim(), '1/1');
+ out.unmount();
+ }
+ });
+
it('shows a closed stack without suggesting it can be merged', function () {
const pr = new PullRequestBuilder().state(GithubItemStateEnum.Closed).stack({
position: 1,
@@ -264,7 +285,7 @@ describe('Overview', function () {
,
);
- assert(out.container.querySelector('#pull-request-stack')?.textContent?.includes('2 pull requests in this stack.'));
+ assert.strictEqual(out.container.querySelector('.stack-description')?.textContent, '2 pull requests in this stack.');
assert.deepStrictEqual([...out.container.querySelectorAll('.stack-entry-readiness')].map(entry => entry.getAttribute('aria-label')), [
'Mergeability is being checked',
'Closed pull request cannot be merged',