From 563e6433b9eec30ec404abed1cbfcf2bb2279119 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Thu, 20 May 2021 15:47:11 +0100
Subject: [PATCH] Don't store blurhash in state, its immutable and pointless
---
src/components/views/messages/MImageBody.js | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/components/views/messages/MImageBody.js b/src/components/views/messages/MImageBody.js
index 14043b95f3..34320f1b31 100644
--- a/src/components/views/messages/MImageBody.js
+++ b/src/components/views/messages/MImageBody.js
@@ -60,7 +60,6 @@ export default class MImageBody extends React.Component {
this.onClick = this.onClick.bind(this);
this._isGif = this._isGif.bind(this);
- const imageInfo = this.props.mxEvent.getContent().info;
this.state = {
decryptedUrl: null,
@@ -72,7 +71,6 @@ export default class MImageBody extends React.Component {
loadedImageDimensions: null,
hover: false,
showImage: SettingsStore.getValue("showImages"),
- blurhash: imageInfo ? imageInfo['xyz.amorgan.blurhash'] : null, // TODO: Use `blurhash` when MSC2448 lands.
};
this._image = createRef();
@@ -442,8 +440,9 @@ export default class MImageBody extends React.Component {
// Overidden by MStickerBody
getPlaceholder(width, height) {
- if (!this.state.blurhash) return null;
- return ;
+ const blurhash = this.props.mxEvent.getContent().info['xyz.amorgan.blurhash'];
+ if (!blurhash) return null;
+ return ;
}
// Overidden by MStickerBody