Skip to content

Commit

Permalink
Remove redundant show() / hide() in expand() / collapse()
Browse files Browse the repository at this point in the history
PR microsoft#176641 cleaned up the redundant, explicit calls to these methods in
`toggleExpand()` as they already happen in the
`onDidChangeCollapsibleState` listener if `_expanded` doesn't match the
new collapsible state. `hide()` was also adjusted there to call
`deleteCommentThread()` as needed.
  • Loading branch information
hermannloose committed Mar 13, 2023
1 parent dea2281 commit 3312e33
Showing 1 changed file with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,22 +257,12 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
this.commentService.disposeCommentThread(this.owner, this._commentThread.threadId);
}

public collapse(): Promise<void> {
public collapse() {
this._commentThread.collapsibleState = languages.CommentThreadCollapsibleState.Collapsed;
if (this._commentThread.comments && this._commentThread.comments.length === 0) {
this.deleteCommentThread();
return Promise.resolve();
}

this.hide();
return Promise.resolve();
}

public expand(): Promise<void> {
public expand() {
this._commentThread.collapsibleState = languages.CommentThreadCollapsibleState.Expanded;

this.show(this.arrowPosition(this._commentThread.range), 2);
return Promise.resolve();
}

public getGlyphPosition(): number {
Expand Down

0 comments on commit 3312e33

Please sign in to comment.