mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
Sessions: fix stale CI checks when switching active session (#304062)
* feat: enhance GitHub PR handling with headSha support and immediate refresh on session change * feat: implement immediate PR data refresh on active session change * feat: add URI import and enhance session resource handling in GitHubActiveSessionRefreshContribution
This commit is contained in:
committed by
GitHub
parent
5e748c905d
commit
13d5f73773
@@ -903,6 +903,7 @@ export class ChangesViewPane extends ViewPane {
|
||||
// Bind CI status widget to active session's PR CI model
|
||||
if (this.ciStatusWidget) {
|
||||
const activeSessionResourceObs = derived(this, reader => this.sessionManagementService.activeSession.read(reader)?.resource);
|
||||
|
||||
const ciModelObs = derived(this, reader => {
|
||||
const session = this.sessionManagementService.activeSession.read(reader);
|
||||
if (!session) {
|
||||
@@ -912,16 +913,18 @@ export class ChangesViewPane extends ViewPane {
|
||||
if (!context || context.prNumber === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
// Use the PR's headRef from the PR model to get CI checks
|
||||
const prModel = this.gitHubService.getPullRequest(context.owner, context.repo, context.prNumber);
|
||||
const pr = prModel.pullRequest.read(reader);
|
||||
if (!pr) {
|
||||
// Trigger a refresh if PR data isn't loaded yet
|
||||
prModel.refresh();
|
||||
return undefined;
|
||||
}
|
||||
const ciModel = this.gitHubService.getPullRequestCI(context.owner, context.repo, pr.headRef);
|
||||
// Use the PR's headSha (commit SHA) rather than the branch
|
||||
// name so CI checks can still be fetched after branch deletion
|
||||
// (e.g. after the PR is merged).
|
||||
const ciModel = this.gitHubService.getPullRequestCI(context.owner, context.repo, pr.headSha);
|
||||
ciModel.refresh();
|
||||
ciModel.startPolling();
|
||||
reader.store.add({ dispose: () => ciModel.stopPolling() });
|
||||
return ciModel;
|
||||
});
|
||||
this.renderDisposables.add(this.ciStatusWidget.bind(ciModelObs, activeSessionResourceObs));
|
||||
|
||||
Reference in New Issue
Block a user