Skip to content

Commit cefe969

Browse files
authored
VSCode unresponsive during GitHub Pull Requests PR checkout (large number of files changed) (#7841)
Fixes #6952
1 parent 563711a commit cefe969

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

src/view/reviewManager.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,18 @@ export class ReviewManager extends Disposable {
623623
}
624624
}
625625

626+
private _openFirstDiff() {
627+
if (this._reviewModel.localFileChanges.length) {
628+
this.openDiff();
629+
} else {
630+
const localFileChangesDisposable = this._reviewModel.onDidChangeLocalFileChanges(() => {
631+
localFileChangesDisposable.dispose();
632+
this.openDiff();
633+
});
634+
}
635+
}
636+
637+
626638
private _doFocusShow(pr: PullRequestModel, updateLayout: boolean) {
627639
// Respect the setting 'comments.openView' when it's 'never'.
628640
const shouldShowCommentsView = vscode.workspace.getConfiguration(COMMENTS).get<'never' | string>(OPEN_VIEW);
@@ -638,18 +650,15 @@ export class ReviewManager extends Disposable {
638650
}
639651

640652
if (focusedMode === 'firstDiff') {
641-
if (this._reviewModel.localFileChanges.length) {
642-
this.openDiff();
643-
} else {
644-
const localFileChangesDisposable = this._reviewModel.onDidChangeLocalFileChanges(() => {
645-
localFileChangesDisposable.dispose();
646-
this.openDiff();
647-
});
648-
}
653+
return this._openFirstDiff();
649654
} else if (focusedMode === 'overview') {
650655
return this.openDescription();
651656
} else if (focusedMode === 'multiDiff') {
652-
return PullRequestModel.openChanges(this._folderRepoManager, pr);
657+
if (pr.fileChanges.size < 400) {
658+
return PullRequestModel.openChanges(this._folderRepoManager, pr);
659+
} else {
660+
return this._openFirstDiff();
661+
}
653662
}
654663
}
655664
}

0 commit comments

Comments
 (0)