PLT-6147 Fixed reactions not rendering properly while loading (#5958)

Этот коммит содержится в:
Harrison Healey
2017-04-04 00:21:15 -04:00
коммит произвёл Corey Hulen
родитель 0a81dd9fff
Коммит 63cdb89144
4 изменённых файлов: 37 добавлений и 39 удалений

Просмотреть файл

@@ -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}
/>
);
}
}

Просмотреть файл

@@ -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]);
}
}
}