Fix live updates to reaction row buttons
This makes the reaction row buttons take the current count as prop as an easy way of ensuring they always trigger an update when the count changes. Fixes https://github.com/vector-im/riot-web/issues/9954
This commit is contained in:
parent
85858c731c
commit
c8cd1f30dd
2 changed files with 4 additions and 6 deletions
|
@ -27,6 +27,8 @@ export default class ReactionsRowButton extends React.PureComponent {
|
|||
mxEvent: PropTypes.object.isRequired,
|
||||
// The reaction content / key / emoji
|
||||
content: PropTypes.string.isRequired,
|
||||
// The count of votes for this key
|
||||
count: PropTypes.number.isRequired,
|
||||
// A Set of Martix reaction events for this key
|
||||
reactionEvents: PropTypes.object.isRequired,
|
||||
// A possible Matrix event if the current user has voted for this type
|
||||
|
@ -77,12 +79,7 @@ export default class ReactionsRowButton extends React.PureComponent {
|
|||
render() {
|
||||
const ReactionsRowButtonTooltip =
|
||||
sdk.getComponent('messages.ReactionsRowButtonTooltip');
|
||||
const { content, reactionEvents, myReactionEvent } = this.props;
|
||||
|
||||
const count = reactionEvents.size;
|
||||
if (!count) {
|
||||
return null;
|
||||
}
|
||||
const { content, count, reactionEvents, myReactionEvent } = this.props;
|
||||
|
||||
const classes = classNames({
|
||||
mx_ReactionsRowButton: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue