Skip to content

Commit 6370d95

Browse files
authored
Set visibility of markdown cells before rendering it (microsoft#126099)
Backports fix for microsoft#126056 to 1.57 For microsoft#126056 This was regressed when we made rendering potentially be async
1 parent b4c1bd0 commit 6370d95

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ async function webviewPreloads(style: PreloadStyles, options: PreloadOptions, re
10711071
}
10721072
}
10731073

1074-
async function createMarkdownPreview(cellId: string, content: string, top: number): Promise<HTMLElement> {
1074+
async function createMarkdownPreview(cellId: string, content: string, top: number, visible: boolean): Promise<HTMLElement> {
10751075
const container = document.getElementById('container')!;
10761076
const cellContainer = document.createElement('div');
10771077

@@ -1084,6 +1084,7 @@ async function webviewPreloads(style: PreloadStyles, options: PreloadOptions, re
10841084
cellContainer.id = cellId;
10851085
cellContainer.classList.add('preview');
10861086

1087+
cellContainer.style.visibility = visible ? 'visible' : 'hidden';
10871088
cellContainer.style.position = 'absolute';
10881089
cellContainer.style.top = top + 'px';
10891090
container.appendChild(cellContainer);
@@ -1157,12 +1158,11 @@ async function webviewPreloads(style: PreloadStyles, options: PreloadOptions, re
11571158
await Promise.all(update.map(async cell => {
11581159
let container = document.getElementById(cell.cellId);
11591160
if (container) {
1161+
container.style.visibility = cell.visible ? 'visible' : 'hidden';
11601162
await updateMarkdownPreview(container, cell.cellId, cell.content);
11611163
} else {
1162-
container = await createMarkdownPreview(cell.cellId, cell.content, cell.offset);
1164+
container = await createMarkdownPreview(cell.cellId, cell.content, cell.offset, cell.visible);
11631165
}
1164-
1165-
container.style.visibility = cell.visible ? 'visible' : 'hidden';
11661166
}));
11671167
}
11681168

0 commit comments

Comments
 (0)