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
Этот коммит содержится в:
Joram Wilander
2017-05-02 09:28:44 -04:00
коммит произвёл Harrison Healey
родитель 294bd08255
Коммит 042052aec6
4 изменённых файлов: 11 добавлений и 25 удалений

Просмотреть файл

@@ -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(),