Skip to content

Commit 0456d9c

Browse files
authored
Copilot on my behalf does not update when closing PR (#8003)
Fixes #8002
1 parent ba96154 commit 0456d9c

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/github/copilotPrWatcher.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as vscode from 'vscode';
7+
import { GithubItemStateEnum } from './interface';
78
import { PullRequestModel } from './pullRequestModel';
89
import { PullRequestOverviewPanel } from './pullRequestOverview';
910
import { RepositoriesManager } from './repositoriesManager';
@@ -275,12 +276,19 @@ export class CopilotPRWatcher extends Disposable {
275276
}
276277
latestEvent = CopilotPRStatus.Started;
277278
}
279+
280+
if (pr.state !== GithubItemStateEnum.Open) {
281+
// PR has been closed or merged, time to remove it.
282+
const key = this._model.makeKey(pr.remote.owner, pr.remote.repositoryName, pr.number);
283+
this._model.deleteKey(key);
284+
return;
285+
}
286+
278287
const lastStatus = this._model.get(pr.remote.owner, pr.remote.repositoryName, pr.number) ?? CopilotPRStatus.None;
279288
if (latestEvent !== lastStatus) {
280289
changes.push({ item: pr, status: latestEvent });
281290
}
282291
this._model.set(changes);
283292
}
284293

285-
286294
}

0 commit comments

Comments
 (0)