From 1bd0d9e02b891d70b9e6d30b69ce0907c48c367b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 6 Oct 2020 22:53:34 +0100 Subject: [PATCH] Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/ReplyThread.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/views/elements/ReplyThread.js b/src/components/views/elements/ReplyThread.js index b7a19661b5..2316fa31d3 100644 --- a/src/components/views/elements/ReplyThread.js +++ b/src/components/views/elements/ReplyThread.js @@ -235,13 +235,17 @@ export default class ReplyThread extends React.Component { } } + updateForEventId = (eventId) => { + if (this.state.events.some(event => event.getId() === eventId)) { + this.forceUpdate(); + } + }; + onEventReplaced = (ev) => { if (this.unmounted) return; - // If one of the events we are rendering gets redacted, force a re-render - if (this.state.events.some(event => event.getId() === ev.getId())) { - this.forceUpdate(); - } + // If one of the events we are rendering gets replaced, force a re-render + this.updateForEventId(ev.getId()); }; onRoomRedaction = (ev) => { @@ -251,9 +255,7 @@ export default class ReplyThread extends React.Component { if (!eventId) return; // If one of the events we are rendering gets redacted, force a re-render - if (this.state.events.some(event => event.getId() === eventId)) { - this.forceUpdate(); - } + this.updateForEventId(eventId); }; async initialize() {