Change to `componentDidUpdate` to process first reaction

This changes to "did update" and also calls the reaction change handler to
ensure that we update the state of my reactions (to know which were sent by
you).
pull/21833/head
J. Ryan Stinnett 2019-05-10 17:59:17 +01:00
parent dc4fccd291
commit 33513a95d7
2 changed files with 10 additions and 8 deletions

View File

@ -41,10 +41,11 @@ export default class ReactionDimension extends React.PureComponent {
}
}
componentWillReceiveProps(nextProps) {
if (this.props.reactions !== nextProps.reactions) {
nextProps.reactions.on("Relations.add", this.onReactionsChange);
nextProps.reactions.on("Relations.redaction", this.onReactionsChange);
componentDidUpdate(prevProps) {
if (prevProps.reactions !== this.props.reactions) {
this.props.reactions.on("Relations.add", this.onReactionsChange);
this.props.reactions.on("Relations.redaction", this.onReactionsChange);
this.onReactionsChange();
}
}

View File

@ -42,10 +42,11 @@ export default class ReactionsRow extends React.PureComponent {
};
}
componentWillReceiveProps(nextProps) {
if (this.props.reactions !== nextProps.reactions) {
nextProps.reactions.on("Relations.add", this.onReactionsChange);
nextProps.reactions.on("Relations.redaction", this.onReactionsChange);
componentDidUpdate(prevProps) {
if (prevProps.reactions !== this.props.reactions) {
this.props.reactions.on("Relations.add", this.onReactionsChange);
this.props.reactions.on("Relations.redaction", this.onReactionsChange);
this.onReactionsChange();
}
}