From 8ad057c2c7f8f05c183f4e1b91d3eee112c8831d Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Thu, 1 Jun 2017 14:16:51 -0400 Subject: Prevent re-rendering of sidebar when typing into channel switcher (#6547) --- webapp/components/sidebar.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'webapp/components/sidebar.jsx') diff --git a/webapp/components/sidebar.jsx b/webapp/components/sidebar.jsx index a802c2f4f..5674e8c75 100644 --- a/webapp/components/sidebar.jsx +++ b/webapp/components/sidebar.jsx @@ -105,11 +105,12 @@ export default class Sidebar extends React.Component { const preferences = getMyPreferences(store.getState()); const profiles = getUsers(store.getState()); let displayableChannels = {}; - if (channels !== this.oldChannels || - preferences !== this.oldPreferences || - profiles !== this.oldProfiles) { + if (!Utils.areObjectsEqual(channels, this.oldChannels) || + !Utils.areObjectsEqual(preferences, this.oldPreferences) || + !Utils.areObjectsEqual(profiles, this.oldProfiles)) { const channelsArray = channels.map((channel) => Object.assign({}, channel)); displayableChannels = ChannelUtils.buildDisplayableChannelList(channelsArray); + displayableChannels.favoriteChannels.sort(sortTeamsByDisplayName); } this.oldChannels = channels; this.oldPreferences = preferences; @@ -641,7 +642,6 @@ export default class Sidebar extends React.Component { // create elements for all 4 types of channels const favoriteItems = this.state.favoriteChannels. - sort(sortTeamsByDisplayName). map((channel, index, arr) => { if (channel.type === Constants.DM_CHANNEL) { return this.createChannelElement(channel, index, arr, this.handleLeaveDirectChannel); -- cgit v1.2.3-1-g7c22