aboutsummaryrefslogtreecommitdiff
path: root/vnext/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-06-20 22:15:36 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:53 +0300
commit49014d386cfd21d3434f376baa9c6b9ee0da62c6 (patch)
treead5be8ff9fd9abda795a8f2c496c40b2ba0325a8 /vnext/src
parent85a0c42fad5cb21a07c674a45fc159569865271a (diff)
correct loading flow
Diffstat (limited to 'vnext/src')
-rw-r--r--vnext/src/components/Thread.js33
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>
)