Merge pull request #6099 from matrix-org/gsouquet/decoratedavatar-icon

Prevent DecoratedRoomAvatar to update its state for the same value
pull/21833/head
Germain 2021-05-25 17:09:32 +01:00 committed by GitHub
commit 3d302a3beb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -119,7 +119,10 @@ export default class DecoratedRoomAvatar extends React.PureComponent<IProps, ISt
if (this.props.room.roomId !== room.roomId) return;
if (ev.getType() === 'm.room.join_rules' || ev.getType() === 'm.room.member') {
this.setState({icon: this.calculateIcon()});
const newIcon = this.calculateIcon();
if (newIcon !== this.state.icon) {
this.setState({icon: newIcon});
}
}
};