Merge pull request #697 from msgmaxim/mentions-fix

Fix not awaiting on promises in mentions
pull/709/head
Maxim Shishmarev 5 years ago committed by GitHub
commit dcc3232b2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -31,12 +31,13 @@ class Mention extends React.Component<MentionProps, MentionState> {
}
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<MentionProps, MentionState> {
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();

Loading…
Cancel
Save