Skip to content

Commit

Permalink
Always mark notebook list rendering elementDisposables as disposed (#…
Browse files Browse the repository at this point in the history
…163382)

Mark notebook list rendering elementDisposables as disposed

This updates `disposeTemplate` for notebook list rendering to mark the `elementDisposables` as disposed instead of simply clearing them. This is helpful if you are using `TRACK_DISPOSABLES`, and will also log if you try adding to the disposable after it has been disposed of

Also marks more template fields as readonly
  • Loading branch information
mjbvz authored Oct 12, 2022
1 parent 8b02488 commit fdb8812
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export interface CellDiffSingleSideRenderTemplate extends CellDiffCommonRenderTe
readonly metadataInfoContainer: HTMLElement;
readonly outputHeaderContainer: HTMLElement;
readonly outputInfoContainer: HTMLElement;

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export class CellDiffSingleSideRenderer implements IListRenderer<SingleSideDiffE
disposeTemplate(templateData: CellDiffSingleSideRenderTemplate): void {
templateData.container.innerText = '';
templateData.sourceEditor.dispose();
templateData.elementDisposables.dispose();
}

disposeElement(element: SingleSideDiffElementViewModel, index: number, templateData: CellDiffSingleSideRenderTemplate): void {
Expand Down Expand Up @@ -275,6 +276,7 @@ export class CellDiffSideBySideRenderer implements IListRenderer<SideBySideDiffE
templateData.container.innerText = '';
templateData.sourceEditor.dispose();
templateData.toolbar?.dispose();
templateData.elementDisposables.dispose();
}

disposeElement(element: SideBySideDiffElementViewModel, index: number, templateData: CellDiffSideBySideRenderTemplate): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ export interface INotebookCellList {
}

export interface BaseCellRenderTemplate {
rootContainer: HTMLElement;
editorPart: HTMLElement;
cellInputCollapsedContainer: HTMLElement;
instantiationService: IInstantiationService;
container: HTMLElement;
cellContainer: HTMLElement;
readonly rootContainer: HTMLElement;
readonly editorPart: HTMLElement;
readonly cellInputCollapsedContainer: HTMLElement;
readonly instantiationService: IInstantiationService;
readonly container: HTMLElement;
readonly cellContainer: HTMLElement;
readonly templateDisposables: DisposableStore;
readonly elementDisposables: DisposableStore;
currentRenderedCell?: ICellViewModel;
Expand All @@ -106,8 +106,8 @@ export interface BaseCellRenderTemplate {
}

export interface MarkdownCellRenderTemplate extends BaseCellRenderTemplate {
editorContainer: HTMLElement;
foldingIndicator: HTMLElement;
readonly editorContainer: HTMLElement;
readonly foldingIndicator: HTMLElement;
currentEditor?: ICodeEditor;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ export class MarkupCellRenderer extends AbstractCellRenderer implements IListRen
}

disposeTemplate(templateData: MarkdownCellRenderTemplate): void {
templateData.templateDisposables.clear();
templateData.elementDisposables.dispose();
templateData.templateDisposables.dispose();
}

disposeElement(_element: ICellViewModel, _index: number, templateData: MarkdownCellRenderTemplate): void {
Expand Down

0 comments on commit fdb8812

Please sign in to comment.