Skip to content

Commit 1f5e142

Browse files
authored
One more pass over reducing unnecessary refreshes of PRs view (#7359)
Fixes #7141
1 parent 54636ee commit 1f5e142

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

src/commands.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,6 @@ export function registerCommands(
812812
if (value === yes) {
813813
try {
814814
isDraft = (await pullRequest.setReadyForReview()).isDraft;
815-
vscode.commands.executeCommand('pr.refreshList');
816815
return isDraft;
817816
} catch (e) {
818817
vscode.window.showErrorMessage(

src/github/activityBarViewProvider.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,6 @@ export class PullRequestViewProvider extends WebviewViewBase implements vscode.W
441441
this._item
442442
.setReadyForReview()
443443
.then(result => {
444-
vscode.commands.executeCommand('pr.refreshList');
445-
446444
this._replyMessage(message, result);
447445
})
448446
.catch(e => {

src/github/folderRepositoryManager.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,12 @@ export class FolderRepositoryManager extends Disposable {
11661166
Logger.debug(`Fetch pull request category ${categoryQuery} - enter`, this.id);
11671167
const { octokit, query, schema } = await githubRepository.ensure();
11681168

1169+
/* __GDPR__
1170+
"pr.search.category" : {
1171+
}
1172+
*/
1173+
this.telemetry.sendTelemetryEvent('pr.search.category');
1174+
11691175
const user = (await githubRepository.getAuthenticatedUser()).login;
11701176
// Search api will not try to resolve repo that redirects, so get full name first
11711177
repo = await githubRepository.getMetadata();
@@ -1203,7 +1209,7 @@ export class FolderRepositoryManager extends Disposable {
12031209
// Pull requests fetched with a query can be from any repo.
12041210
// We need to use the correct GitHubRepository for this PR.
12051211
return response.repo.createOrUpdatePullRequestModel(
1206-
await parseGraphQLPullRequest(response.data.repository.pullRequest, response.repo),
1212+
await parseGraphQLPullRequest(response.data.repository.pullRequest, response.repo), true
12071213
);
12081214
})))
12091215
.filter(item => item !== null) as PullRequestModel[];

src/github/githubRepository.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ export class GitHubRepository extends Disposable {
959959
}
960960
}
961961

962-
createOrUpdatePullRequestModel(pullRequest: PullRequest): PullRequestModel {
962+
createOrUpdatePullRequestModel(pullRequest: PullRequest, silent: boolean = false): PullRequestModel {
963963
let model = this._pullRequestModelsByNumber.get(pullRequest.number)?.model;
964964
if (model) {
965965
model.update(pullRequest);
@@ -969,7 +969,9 @@ export class GitHubRepository extends Disposable {
969969
const disposables: vscode.Disposable[] = [];
970970
disposables.push(model.onDidChange(() => this._onPullRequestModelChanged(prModel)));
971971
this._pullRequestModelsByNumber.set(pullRequest.number, { model, disposables });
972-
this._onDidAddPullRequest.fire(model);
972+
if (!silent) {
973+
this._onDidAddPullRequest.fire(model);
974+
}
973975
}
974976

975977
return model;

src/github/pullRequestOverview.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,6 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode
630630
this._item
631631
.setReadyForReview()
632632
.then(result => {
633-
vscode.commands.executeCommand('pr.refreshList');
634-
635633
this._replyMessage(message, result);
636634
})
637635
.catch(e => {

0 commit comments

Comments
 (0)