diff options
Diffstat (limited to 'vnext/src/components/Thread.js')
-rw-r--r-- | vnext/src/components/Thread.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/vnext/src/components/Thread.js b/vnext/src/components/Thread.js index df3f460a..9ef5c5b9 100644 --- a/vnext/src/components/Thread.js +++ b/vnext/src/components/Thread.js @@ -20,6 +20,7 @@ export default class Thread extends React.Component { this.state = { msg: msg || {}, replies: [], + loading: false, active: 0 }; } @@ -29,7 +30,7 @@ export default class Thread extends React.Component { this.loadReplies(); } loadReplies() { - this.setState({ replies: [] }) + this.setState({ replies: [], loading: true }) const { mid } = this.props.match.params; let params = { mid: mid @@ -43,6 +44,7 @@ export default class Thread extends React.Component { this.setState({ msg: msg, replies: response.data, + loading: false, active: 0 }) } @@ -50,9 +52,6 @@ export default class Thread extends React.Component { console.log(ex); }); } - loaded = () => { - return (this.state.replies && this.state.replies.length > 0) || ('mid' in this.state.msg && !('replies' in this.state.msg)); - } setActive(msg, event) { this.setState({ active: msg.rid || 0 @@ -93,7 +92,7 @@ export default class Thread extends React.Component { <h2>{msg.replies && `Replies (${msg.replies})`}</h2> </div> } - {this.loaded() ? ( + {!this.state.loading ? ( <ul id="replies"> { this.state.replies.map((msg) => ( |