mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 11:47:23 +03:00
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).
This commit is contained in:
parent
dc4fccd291
commit
33513a95d7
2 changed files with 10 additions and 8 deletions
|
@ -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 a new issue