diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-05-02 09:28:44 -0400 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-05-02 09:28:44 -0400 |
commit | 042052aec61b8c51751cb3aeb27c6c21ecf16416 (patch) | |
tree | cedfee7c1ddecacdddc155a453f33b717b233490 /webapp/components/sidebar.jsx | |
parent | 294bd0825550cd8de557a8b36facfc601f32bd82 (diff) | |
download | chat-042052aec61b8c51751cb3aeb27c6c21ecf16416.tar.gz chat-042052aec61b8c51751cb3aeb27c6c21ecf16416.tar.bz2 chat-042052aec61b8c51751cb3aeb27c6c21ecf16416.zip |
Improve perf for channel switching, fix team switching issues (#6286)
* Improve perf for channel switching, fix team switching issues
* Fix last channel when switching teams
Diffstat (limited to 'webapp/components/sidebar.jsx')
-rw-r--r-- | webapp/components/sidebar.jsx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/webapp/components/sidebar.jsx b/webapp/components/sidebar.jsx index 71559de02..465d25576 100644 --- a/webapp/components/sidebar.jsx +++ b/webapp/components/sidebar.jsx @@ -116,14 +116,19 @@ export default class Sidebar extends React.Component { const currentChannelId = ChannelStore.getCurrentId(); const tutorialStep = PreferenceStore.getInt(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), 999); - const allChannels = ChannelStore.getAll().map((channel) => Object.assign({}, channel)); - const channelList = ChannelUtils.buildDisplayableChannelList(allChannels); + const channels = ChannelStore.getAll(); + let displayableChannels = {}; + if (channels !== this.oldChannels) { + const channelsArray = channels.map((channel) => Object.assign({}, channel)); + displayableChannels = ChannelUtils.buildDisplayableChannelList(channelsArray); + } + this.oldChannels = channels; return { activeId: currentChannelId, members, teamMembers, - ...channelList, + ...displayableChannels, unreadCounts: JSON.parse(JSON.stringify(ChannelStore.getUnreadCounts())), showTutorialTip: tutorialStep === TutorialSteps.CHANNEL_POPOVER, currentTeam: TeamStore.getCurrent(), |