Big emojis: fix race condition

This commit is contained in:
Alex Gleason
2021-07-09 18:52:06 -05:00
parent 8b4d855758
commit 22254ec6bb

View File

@ -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 });
}
}