aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-07-05 13:58:25 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:53 +0300
commit338850d6908a7ea803d45606932cce1f7b82cfeb (patch)
tree05701dff580b19c421ef2a82dda185dde5830b23
parent2c081b341b09e734dc8aa9d3fd034477767373bc (diff)
fix recommendations
-rw-r--r--vnext/src/components/Thread.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/vnext/src/components/Thread.js b/vnext/src/components/Thread.js
index 3de16a64..f6068614 100644
--- a/vnext/src/components/Thread.js
+++ b/vnext/src/components/Thread.js
@@ -41,7 +41,7 @@ export default class Thread extends React.Component {
.then(response => {
let msg = response.data.shift();
this.setState({
- msg: msg,
+ msg: {...msg},
replies: response.data,
loading: false,
active: 0
@@ -82,7 +82,7 @@ export default class Thread extends React.Component {
msg.mid ? (
<Message data={msg} visitor={this.props.visitor}>
{this.state.active === (msg.rid || 0) && <MessageInput data={msg} onSend={this.postComment}>Write a comment...</MessageInput>}
- <Recommendations src={msg.recommendations} />
+ <Recommendations src={msg.recommendations || []} />
</Message>
) : (
<Spinner />
@@ -160,7 +160,7 @@ const linkStyle = {
}
function Recommendations({src, ...rest}) {
- return src && (
+ return src.length > 0 && (
<div className="msg-recomms">{`Recommended by (${src.length}): `}
{
src.map(it => (