diff options
Diffstat (limited to 'vnext/src/components/Thread.js')
-rw-r--r-- | vnext/src/components/Thread.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/vnext/src/components/Thread.js b/vnext/src/components/Thread.js index a1aaa837..a404cf57 100644 --- a/vnext/src/components/Thread.js +++ b/vnext/src/components/Thread.js @@ -13,8 +13,9 @@ import { format } from '../utils/embed'; export default class Thread extends React.Component { constructor(props) { super(props); + const { msg } = this.props.location.state || {} this.state = { - msg: {}, + msg: msg, replies: [], active: 0 }; @@ -53,7 +54,7 @@ export default class Thread extends React.Component { }); } loaded() { - return this.state.msg.mid; + return this.state.msg && this.state.msg.mid; } setActive(msg, event) { this.setState({ @@ -85,7 +86,7 @@ export default class Thread extends React.Component { <ul id="0"> <li className="msg msgthread"> { - this.loaded() ? ( + this.state.msg ? ( <Message data={msg} visitor={this.props.visitor}> { this.state.active === (msg.rid || 0) && <MessageInput data={msg} onSend={this.postComment} /> } <Recommendations src={msg.recommendations} /> @@ -97,7 +98,7 @@ export default class Thread extends React.Component { </li> </ul> { - this.loaded() && ( + this.loaded() ? ( <React.Fragment> <div className="title2"> { @@ -165,6 +166,8 @@ export default class Thread extends React.Component { } </ul> </React.Fragment> + ) : ( + <Spinner /><Spinner /><Spinner /> ) } </React.Fragment> |