Skip to content

Commit d628c3b

Browse files
committed
Make sure we call update after the binary size of the image is computed
Fixes a possible race if the dimensions of the image are computed before the get the size (which is unlikely but possible)
1 parent 14e6ad3 commit d628c3b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

extensions/image-preview/src/preview.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,11 @@ class Preview extends Disposable implements vscode.WebviewEditorEditingCapabilit
147147
}
148148
}));
149149

150-
(async () => {
151-
const { size } = await vscode.workspace.fs.stat(resource);
150+
vscode.workspace.fs.stat(resource).then(({ size }) => {
152151
this._imageBinarySize = size;
153-
})();
152+
this.update();
153+
});
154+
154155
this.render();
155156
this.update();
156157
this.webviewEditor.webview.postMessage({ type: 'setActive', value: this.webviewEditor.active });

0 commit comments

Comments
 (0)