diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2017-04-04 00:21:15 -0400 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2017-04-03 21:21:15 -0700 |
commit | 63cdb89144f27929928f819b4ffae936ff79ac15 (patch) | |
tree | c732d2f8955dbd857a6c29bb04a720a35f767d48 /webapp/components/post_view | |
parent | 0a81dd9fff606d041ee08c62c655bf6966c7a66a (diff) | |
download | chat-63cdb89144f27929928f819b4ffae936ff79ac15.tar.gz chat-63cdb89144f27929928f819b4ffae936ff79ac15.tar.bz2 chat-63cdb89144f27929928f819b4ffae936ff79ac15.zip |
PLT-6147 Fixed reactions not rendering properly while loading (#5958)
Diffstat (limited to 'webapp/components/post_view')
-rw-r--r-- | webapp/components/post_view/components/reaction_list_container.jsx | 18 | ||||
-rw-r--r-- | webapp/components/post_view/components/reaction_list_view.jsx | 20 |
2 files changed, 20 insertions, 18 deletions
diff --git a/webapp/components/post_view/components/reaction_list_container.jsx b/webapp/components/post_view/components/reaction_list_container.jsx index 906145eed..cdc58003b 100644 --- a/webapp/components/post_view/components/reaction_list_container.jsx +++ b/webapp/components/post_view/components/reaction_list_container.jsx @@ -81,16 +81,12 @@ export default class ReactionListContainer extends React.Component { } render() { - if (this.props.post.has_reactions && this.state.reactions.length > 0) { - return ( - <ReactionListView - post={this.props.post} - reactions={this.state.reactions} - emojis={this.state.emojis} - /> - ); - } - - return null; + return ( + <ReactionListView + post={this.props.post} + reactions={this.state.reactions} + emojis={this.state.emojis} + /> + ); } } diff --git a/webapp/components/post_view/components/reaction_list_view.jsx b/webapp/components/post_view/components/reaction_list_view.jsx index c322ce727..b6c4b3a19 100644 --- a/webapp/components/post_view/components/reaction_list_view.jsx +++ b/webapp/components/post_view/components/reaction_list_view.jsx @@ -13,17 +13,23 @@ export default class ReactionListView extends React.Component { } render() { + if (!this.props.post.has_reactions || (this.props.reactions && this.props.reactions.length === 0)) { + return null; + } + const reactionsByName = new Map(); const emojiNames = []; - for (const reaction of this.props.reactions) { - const emojiName = reaction.emoji_name; + if (this.props.reactions) { + for (const reaction of this.props.reactions) { + const emojiName = reaction.emoji_name; - if (reactionsByName.has(emojiName)) { - reactionsByName.get(emojiName).push(reaction); - } else { - emojiNames.push(emojiName); - reactionsByName.set(emojiName, [reaction]); + if (reactionsByName.has(emojiName)) { + reactionsByName.get(emojiName).push(reaction); + } else { + emojiNames.push(emojiName); + reactionsByName.set(emojiName, [reaction]); + } } } |