diff --git a/ts/components/conversation/AddMentions.tsx b/ts/components/conversation/AddMentions.tsx index 8b4161584..8cfa0cb40 100644 --- a/ts/components/conversation/AddMentions.tsx +++ b/ts/components/conversation/AddMentions.tsx @@ -31,12 +31,13 @@ class Mention extends React.Component { } public componentWillMount() { - const found = this.findMember(this.props.text.slice(1)); - this.setState({ found }); - this.tryRenameMention(); + this.setState({ found: false }); + // TODO: give up after some period of time? this.intervalHandle = setInterval(this.tryRenameMention, 30000); + + this.tryRenameMention(); } public componentWillUnmount() { @@ -71,8 +72,8 @@ class Mention extends React.Component { clearInterval(this.intervalHandle); } - private tryRenameMention() { - const found = this.findMember(this.props.text.slice(1)); + private async tryRenameMention() { + const found = await this.findMember(this.props.text.slice(1)); if (found) { this.setState({ found }); this.clearOurInterval();