Prevent unneeded state updates to hide StickerPicker

This commit is contained in:
Germain Souquet 2021-05-25 09:47:45 +01:00
parent 525e3eaf43
commit 73d51a91d6

View file

@ -40,7 +40,7 @@ const STICKERPICKER_Z_INDEX = 3500;
const PERSISTED_ELEMENT_KEY = "stickerPicker"; const PERSISTED_ELEMENT_KEY = "stickerPicker";
@replaceableComponent("views.rooms.Stickerpicker") @replaceableComponent("views.rooms.Stickerpicker")
export default class Stickerpicker extends React.Component { export default class Stickerpicker extends React.PureComponent {
static currentWidget; static currentWidget;
constructor(props) { constructor(props) {
@ -341,21 +341,27 @@ export default class Stickerpicker extends React.Component {
* @param {Event} ev Event that triggered the function call * @param {Event} ev Event that triggered the function call
*/ */
_onHideStickersClick(ev) { _onHideStickersClick(ev) {
this.setState({showStickers: false}); if (this.state.showStickers) {
this.setState({showStickers: false});
}
} }
/** /**
* Called when the window is resized * Called when the window is resized
*/ */
_onResize() { _onResize() {
this.setState({showStickers: false}); if (this.state.showStickers) {
this.setState({showStickers: false});
}
} }
/** /**
* The stickers picker was hidden * The stickers picker was hidden
*/ */
_onFinished() { _onFinished() {
this.setState({showStickers: false}); if (this.state.showStickers) {
this.setState({showStickers: false});
}
} }
/** /**