From 22254ec6bb4e49315c1193d81a2a4e5b2d468a0c Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 9 Jul 2021 18:52:06 -0500 Subject: [PATCH] Big emojis: fix race condition --- app/soapbox/components/status_content.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/soapbox/components/status_content.js b/app/soapbox/components/status_content.js index 16e9134a8..4913b5eb9 100644 --- a/app/soapbox/components/status_content.js +++ b/app/soapbox/components/status_content.js @@ -91,8 +91,11 @@ class StatusContent extends React.PureComponent { } setOnlyEmoji = () => { - if (this.node && this.state.onlyEmoji === undefined) { - this.setState({ onlyEmoji: onlyEmoji(this.node, BIG_EMOJI_LIMIT, true) }); + if (!this.node) return; + const only = onlyEmoji(this.node, BIG_EMOJI_LIMIT, true); + + if (only !== this.state.onlyEmoji) { + this.setState({ onlyEmoji: only }); } }