From fd7dd62c2f08ec993ac2c30f537a53d8e37cff24 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 29 Jun 2018 12:57:34 +0300 Subject: Thread refactoring --- vnext/src/components/Thread.js | 114 +++++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 56 deletions(-) (limited to 'vnext/src/components') diff --git a/vnext/src/components/Thread.js b/vnext/src/components/Thread.js index 2d161621..63359ce0 100644 --- a/vnext/src/components/Thread.js +++ b/vnext/src/components/Thread.js @@ -24,7 +24,9 @@ export default class Thread extends React.Component { }; } componentDidMount() { - this.loadReplies(); + if (this.state.msg.replies > 0) { + this.loadReplies(); + } } loadReplies() { this.setState({ replies: [], loading: true }) @@ -64,6 +66,7 @@ export default class Thread extends React.Component { render() { const msg = this.state.msg; + const loaders = Math.min(msg.replies || 0, 10); return ( - {!this.state.loading ? ( - ) } -- cgit v1.2.3