diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts index fccb8146a01..d8838aa3460 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts @@ -921,7 +921,7 @@ async function webviewPreloads(style: PreloadStyles, options: PreloadOptions, re private readonly _markupCells = new Map(); private readonly _outputCells = new Map(); - private async createMarkupCell(init: webviewMessages.IMarkupCellInitialization, top: number): Promise { + private async createMarkupCell(init: webviewMessages.IMarkupCellInitialization, top: number, visible: boolean): Promise { const existing = this._markupCells.get(init.cellId); if (existing) { console.error(`Trying to create markup that already exists: ${init.cellId}`); @@ -929,6 +929,7 @@ async function webviewPreloads(style: PreloadStyles, options: PreloadOptions, re } const cell = new MarkupCell(init.cellId, init.mime, init.content, top); + cell.element.style.visibility = visible ? 'visible' : 'hidden'; this._markupCells.set(init.cellId, cell); await cell.ready; @@ -939,11 +940,11 @@ async function webviewPreloads(style: PreloadStyles, options: PreloadOptions, re await Promise.all(update.map(async info => { let cell = this._markupCells.get(info.cellId); if (cell) { + cell.element.style.visibility = info.visible ? 'visible' : 'hidden'; await cell.updateContentAndRender(info.content); } else { - cell = await this.createMarkupCell(info, info.offset); + cell = await this.createMarkupCell(info, info.offset, info.visible); } - cell.element.style.visibility = info.visible ? 'visible' : 'hidden'; })); }