Skip to content

Commit

Permalink
Fix two bugs in microsoft#214589.
Browse files Browse the repository at this point in the history
1. We must not `dispose()` the `MutableDisposable` `this._commentThreadWidget` - as that disposes the MutableDisposable itself, and it cannot then later be reassigned to a new value. Instead, we need to assign `value=undefined`, which disposes the previous `value`, but keeps the `MutableDisposable` available to be reused later.
2. `initialize()` is a no-op if `this.currentElement` is already identical to the passed `element`, so we must not do that assignment before calling initialize - instead `initialize()` does the assignment after checking.
  • Loading branch information
rehmsen committed Jun 26, 2024
1 parent e5d157c commit 8e3cd9e
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class CellComments extends CellContentPart {
if (this._commentThreadWidget.value) {
if (!info) {
this._commentThreadDisposables.clear();
this._commentThreadWidget.dispose();
this._commentThreadWidget.value = undefined;
this.currentElement.commentHeight = 0;
return;
}
Expand Down Expand Up @@ -154,7 +154,6 @@ export class CellComments extends CellContentPart {

override didRenderCell(element: ICellViewModel): void {
if (element.cellKind === CellKind.Code) {
this.currentElement = element as CodeCellViewModel;
this.initialize(element);
this._bindListeners();
}
Expand Down

0 comments on commit 8e3cd9e

Please sign in to comment.