Skip to content

Commit d861070

Browse files
authored
Periodic background refresh of PR content (#6807)
Fixes #6739
1 parent 60aca42 commit d861070

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/github/issueOverview.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class IssueOverviewPanel<TItem extends IssueModel = IssueModel> extends W
8585
column: vscode.ViewColumn,
8686
title: string,
8787
folderRepositoryManager: FolderRepositoryManager,
88-
type: string = IssueOverviewPanel._viewType,
88+
private readonly type: string = IssueOverviewPanel._viewType,
8989
iconSubpath?: {
9090
light: string,
9191
dark: string,
@@ -129,6 +129,16 @@ export class IssueOverviewPanel<TItem extends IssueModel = IssueModel> extends W
129129
});
130130
}
131131
}));
132+
this.pollForUpdates(true);
133+
}
134+
135+
private pollForUpdates(shorterTimeout: boolean = false): void {
136+
const webview = shorterTimeout || vscode.window.tabGroups.all.find(group => group.activeTab?.input instanceof vscode.TabInputWebview && group.activeTab.input.viewType.endsWith(this.type));
137+
const timeoutDuration = 1000 * 60 * (webview ? 1 : 5);
138+
setTimeout(async () => {
139+
await this.refreshPanel();
140+
this.pollForUpdates();
141+
}, timeoutDuration);
132142
}
133143

134144
public async refreshPanel(): Promise<void> {

src/view/reviewManager.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ export class ReviewManager extends Disposable {
116116
if (_gitApi.state === 'initialized') {
117117
this.updateState(true);
118118
}
119-
this.pollForStatusChange();
120119
}
121120

122121
private registerListeners(): void {
@@ -241,15 +240,6 @@ export class ReviewManager extends Disposable {
241240
return this._reviewModel;
242241
}
243242

244-
private pollForStatusChange() {
245-
setTimeout(async () => {
246-
if (!this._validateStatusInProgress && this._folderRepoManager.activePullRequest) {
247-
await this.updateComments();
248-
}
249-
this.pollForStatusChange();
250-
}, 1000 * 60 * 5);
251-
}
252-
253243
private get id(): string {
254244
return `${ReviewManager.ID}+${this._id}`;
255245
}

0 commit comments

Comments
 (0)