From 4c08c51044e5bca4523b7374310d486d23e1507c Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 16 Feb 2018 21:24:42 +0000 Subject: [PATCH] Reply; delay call to onWidgetLoad until after async setState completes Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/Reply.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/views/elements/Reply.js b/src/components/views/elements/Reply.js index 4a9d0d3380..bbcfa00b25 100644 --- a/src/components/views/elements/Reply.js +++ b/src/components/views/elements/Reply.js @@ -82,7 +82,6 @@ export default class Reply extends React.Component { } async loadNextEvent() { - this.props.onWidgetLoad(); const ev = this.state.events[0]; const inReplyTo = Reply.getInReplyTo(ev); @@ -90,7 +89,7 @@ export default class Reply extends React.Component { if (this.unmounted) return; this.setState({ loading: false, - }); + }, this.props.onWidgetLoad); return; } @@ -98,9 +97,9 @@ export default class Reply extends React.Component { if (this.unmounted) return; if (loadedEv) { - this.setState({loadedEv}); + this.setState({loadedEv}, this.props.onWidgetLoad); } else { - this.setState({err: true}); + this.setState({err: true}, this.props.onWidgetLoad); } }