Skip to content

Commit

Permalink
After making a change to a PR that was made on a fork the "Files" tre…
Browse files Browse the repository at this point in the history
…e is empty (#3296) (#3307)

Fixes #3294
  • Loading branch information
alexr00 authored Feb 10, 2022
1 parent f8fbe07 commit 01b5fdd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
6 changes: 6 additions & 0 deletions src/view/prChangesTreeDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ export class PullRequestChangesTreeDataProvider extends vscode.Disposable implem
reviewModel: ReviewModel,
shouldReveal: boolean,
) {
if (this._pullRequestManagerMap.has(pullRequestManager)) {
const existingNode = this._pullRequestManagerMap.get(pullRequestManager);
if (existingNode && (existingNode.pullRequestModel === pullRequestModel)) {
return;
}
}
const node: RepositoryChangesNode = new RepositoryChangesNode(
this,
pullRequestModel,
Expand Down
5 changes: 3 additions & 2 deletions src/view/treeNodes/commitsCategoryNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ export class CommitsNode extends TreeNode implements vscode.TreeItem {
this._folderRepoManager = reposManager;
this.collapsibleState = vscode.TreeItemCollapsibleState.Collapsed;

this._pr.onDidChangeReviewThreads(() => this.refresh(this));
this._pr.onDidChangeComments(() => this.refresh(this));
this.childrenDisposables = [];
this.childrenDisposables.push(this._pr.onDidChangeReviewThreads(() => this.refresh(this)));
this.childrenDisposables.push(this._pr.onDidChangeComments(() => this.refresh(this)));
}

getTreeItem(): vscode.TreeItem {
Expand Down
9 changes: 0 additions & 9 deletions src/view/treeNodes/fileChangeNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,6 @@ export class FileChangeNode extends TreeNode implements vscode.TreeItem {
}),
);

this.childrenDisposables.push(this.pullRequest.onDidChangeComments(() => {
this.updateShowOptions();
this.refresh(this);
}));

this.childrenDisposables.push(this.pullRequest.onDidChangeReviewThreads(() => {
this.updateShowOptions();
this.refresh(this);
}));

this.accessibilityInformation = { label: `View diffs and comments for file ${this.label}`, role: 'link' };
}
Expand Down
9 changes: 5 additions & 4 deletions src/view/treeNodes/filesCategoryNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ export class FilesCategoryNode extends TreeNode implements vscode.TreeItem {
constructor(
public parent: TreeNodeParent,
private _reviewModel: ReviewModel,
private _pullRequestModel: PullRequestModel
_pullRequestModel: PullRequestModel
) {
super();
this.collapsibleState = vscode.TreeItemCollapsibleState.Expanded;
this._reviewModel.onDidChangeLocalFileChanges(() => this.refresh(this));
this._pullRequestModel.onDidChangeReviewThreads(() => this.refresh(this));
this._pullRequestModel.onDidChangeComments(() => this.refresh(this));
this.childrenDisposables = [];
this.childrenDisposables.push(this._reviewModel.onDidChangeLocalFileChanges(() => this.refresh(this)));
this.childrenDisposables.push(_pullRequestModel.onDidChangeReviewThreads(() => this.refresh(this)));
this.childrenDisposables.push(_pullRequestModel.onDidChangeComments(() => this.refresh(this)));
}

getTreeItem(): vscode.TreeItem {
Expand Down

0 comments on commit 01b5fdd

Please sign in to comment.