diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-04-29 08:40:06 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-04-29 08:40:06 -0400 |
commit | 1f4974dc02c786b65c802d4497fd736cca79d01c (patch) | |
tree | 1007e452c4a9345dee8aff113f28f235432bf323 /webapp/components/more_direct_channels.jsx | |
parent | 9961ccca7d39bdfabbafce423d3f7fe4b6ed2f29 (diff) | |
download | chat-1f4974dc02c786b65c802d4497fd736cca79d01c.tar.gz chat-1f4974dc02c786b65c802d4497fd736cca79d01c.tar.bz2 chat-1f4974dc02c786b65c802d4497fd736cca79d01c.zip |
General react performance improvements (#2796)
* General React performance improvements
* Cleaned up unused props/state in PermaLinkView and PostFocusView
Diffstat (limited to 'webapp/components/more_direct_channels.jsx')
-rw-r--r-- | webapp/components/more_direct_channels.jsx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/webapp/components/more_direct_channels.jsx b/webapp/components/more_direct_channels.jsx index a83816c40..a7fb2b6cd 100644 --- a/webapp/components/more_direct_channels.jsx +++ b/webapp/components/more_direct_channels.jsx @@ -19,7 +19,6 @@ export default class MoreDirectChannels extends React.Component { this.handleHide = this.handleHide.bind(this); this.handleShowDirectChannel = this.handleShowDirectChannel.bind(this); this.handleUserChange = this.handleUserChange.bind(this); - this.createJoinDirectChannelButton = this.createJoinDirectChannelButton.bind(this); this.state = { @@ -52,6 +51,26 @@ export default class MoreDirectChannels extends React.Component { UserStore.removeChangeListener(this.handleUserChange); } + shouldComponentUpdate(nextProps, nextState) { + if (nextProps.show !== this.props.show) { + return true; + } + + if (nextProps.onModalDismissed.toString() !== this.props.onModalDismissed.toString()) { + return true; + } + + if (nextState.loadingDMChannel !== this.state.loadingDMChannel) { + return true; + } + + if (!Utils.areObjectsEqual(nextState.users, this.state.users)) { + return true; + } + + return false; + } + handleHide() { if (this.props.onModalDismissed) { this.props.onModalDismissed(); |