From 3b008b63597ad84526ca00748241fd273b541f19 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 17 Feb 2019 09:06:50 -0800 Subject: [PATCH] Revoke old camera image after new one has loaded (#2772) --- src/panels/lovelace/components/hui-image.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/panels/lovelace/components/hui-image.ts b/src/panels/lovelace/components/hui-image.ts index cdc7b06aa1..04a12f34d8 100644 --- a/src/panels/lovelace/components/hui-image.ts +++ b/src/panels/lovelace/components/hui-image.ts @@ -167,15 +167,14 @@ class HuiImage extends LitElement { if (!this.hass || !this.cameraImage) { return; } - if (this._cameraImageSrc) { - URL.revokeObjectURL(this._cameraImageSrc); - this._cameraImageSrc = undefined; - } try { const { content_type: contentType, content } = await fetchThumbnail( this.hass, this.cameraImage ); + if (this._cameraImageSrc) { + URL.revokeObjectURL(this._cameraImageSrc); + } this._cameraImageSrc = URL.createObjectURL( b64toBlob(content, contentType) );