mirror of https://github.com/vector-im/riot-web
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
parent
dc4fccd291
commit
33513a95d7
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue