diff options
Diffstat (limited to 'vnext/src/components/Thread.js')
-rw-r--r-- | vnext/src/components/Thread.js | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/vnext/src/components/Thread.js b/vnext/src/components/Thread.js index 2dab4250..ebbb1eec 100644 --- a/vnext/src/components/Thread.js +++ b/vnext/src/components/Thread.js @@ -54,7 +54,7 @@ export default class Thread extends React.Component { }); } loaded() { - return this.state.msg && this.state.msg.mid; + return (this.state.replies && this.state.replies.length > 0) || ( 'mid' in this.state.msg && !('replies' in this.state.msg)); } setActive(msg, event) { this.setState({ @@ -98,15 +98,15 @@ export default class Thread extends React.Component { </li> </ul> { - this.loaded() ? ( - <React.Fragment> - <div className="title2"> - { - this.props.visitor.uid > 0 && - <img style={{ display: 'none' }} src={`https://api.juick.com/thread/mark_read/${msg.mid}-${msg.rid || 0}.gif?hash=${this.props.visitor.hash}`} /> - } - <h2>{msg.replies && `Replies (${msg.replies})`}</h2> - </div> + <React.Fragment> + <div className="title2"> + { + this.props.visitor.uid > 0 && + <img style={{ display: 'none' }} src={`https://api.juick.com/thread/mark_read/${msg.mid}-${msg.rid || 0}.gif?hash=${this.props.visitor.hash}`} /> + } + <h2>{msg.replies && `Replies (${msg.replies})`}</h2> + </div> + {this.loaded() ? ( <ul id="replies"> { this.state.replies.map((msg) => ( @@ -164,13 +164,12 @@ export default class Thread extends React.Component { </li> )) } - </ul> - </React.Fragment> - ) : ( - <React.Fragment> - <Spinner /><Spinner /><Spinner /> - </React.Fragment> - ) + </ul>) : ( + <React.Fragment> + <Spinner /><Spinner /><Spinner /> + </React.Fragment> + )} + </React.Fragment> } </React.Fragment> ) |