diff --git a/packages/plugin-ext/src/main/browser/comments/comment-thread-widget.tsx b/packages/plugin-ext/src/main/browser/comments/comment-thread-widget.tsx index 59e582df1efed..d37c0a5a447b9 100644 --- a/packages/plugin-ext/src/main/browser/comments/comment-thread-widget.tsx +++ b/packages/plugin-ext/src/main/browser/comments/comment-thread-widget.tsx @@ -235,8 +235,8 @@ export class CommentThreadWidget extends BaseWidget { if (this._commentThread.comments && this._commentThread.comments.length) { const onlyUnique = (value: Comment, index: number, self: Comment[]) => self.indexOf(value) === index; const participantsList = this._commentThread.comments.filter(onlyUnique).map(comment => `@${comment.userName}`).join(', '); - const resolved = (this._commentThread.state === CommentThreadState.Resolved) ? '(Resolved)' : '(Unresolved)'; - label = `Participants: ${participantsList} ${resolved}`; + const resolutionState = (this._commentThread.state === CommentThreadState.Resolved) ? '(Resolved)' : '(Unresolved)'; + label = `Participants: ${participantsList} ${resolutionState}`; } else { label = 'Start discussion'; } diff --git a/packages/plugin-ext/src/main/browser/comments/comments-main.ts b/packages/plugin-ext/src/main/browser/comments/comments-main.ts index 683472c9e007c..01a354ccb3c21 100644 --- a/packages/plugin-ext/src/main/browser/comments/comments-main.ts +++ b/packages/plugin-ext/src/main/browser/comments/comments-main.ts @@ -130,8 +130,10 @@ export class CommentThreadImpl implements CommentThread, Disposable { } set state(newState: CommentThreadState | undefined) { - this._state = newState; - this.onDidChangeStateEmitter.fire(this._state); + if (this._state !== newState) { + this._state = newState; + this.onDidChangeStateEmitter.fire(this._state); + } } private readonly onDidChangeStateEmitter = new Emitter(); diff --git a/packages/plugin-ext/src/plugin/comments.ts b/packages/plugin-ext/src/plugin/comments.ts index bc7bffd945e60..e6d810dba9c5a 100644 --- a/packages/plugin-ext/src/plugin/comments.ts +++ b/packages/plugin-ext/src/plugin/comments.ts @@ -278,16 +278,18 @@ export class ExtHostCommentThread implements theia.CommentThread, theia.Disposab this._onDidUpdateCommentThread.fire(); } - private threadState?: theia.CommentThreadState; + private _state?: theia.CommentThreadState; get state(): theia.CommentThreadState { - return this.threadState!; + return this._state!; } set state(newState: theia.CommentThreadState) { - this.threadState = newState; - this.modifications.state = newState; - this._onDidUpdateCommentThread.fire(); + if (this._state !== newState) { + this._state = newState; + this.modifications.state = newState; + this._onDidUpdateCommentThread.fire(); + } } private localDisposables: Disposable[]; @@ -372,7 +374,7 @@ export class ExtHostCommentThread implements theia.CommentThread, theia.Disposab formattedModifications.collapseState = convertToCollapsibleState(this.collapseState); } if (modified('state')) { - formattedModifications.state = convertToState(this.threadState); + formattedModifications.state = convertToState(this._state); } if (modified('canReply')) { formattedModifications.canReply = this.canReply;