From de0787dbd2712fd8fd76a8ba928f87735712657f Mon Sep 17 00:00:00 2001 From: Stefan Dirix Date: Tue, 22 Sep 2020 17:59:54 +0200 Subject: [PATCH] Render initial preview for empty documents The preview-widget checks whether the content of the underlying text document changed before rerendering its content. In case of empty documents this check prevented the initial rendering of the preview. This is now fixed by distinguishing between empty and non-existing content. Signed-off-by: Stefan Dirix Contributed on behalf of STMicroelectronics --- packages/preview/src/browser/preview-widget.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/preview/src/browser/preview-widget.ts b/packages/preview/src/browser/preview-widget.ts index e158617810aa7..32e413f514183 100644 --- a/packages/preview/src/browser/preview-widget.ts +++ b/packages/preview/src/browser/preview-widget.ts @@ -165,11 +165,11 @@ export class PreviewWidget extends BaseWidget implements Navigatable { } protected forceUpdate(): void { - this.previousContent = ''; + this.previousContent = undefined; this.update(); } - protected previousContent: string = ''; + protected previousContent: string | undefined = undefined; protected async performUpdate(): Promise { if (!this.resource) { return;