Prevent re-rendering of sidebar when typing into channel switcher (#6547)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f662d0d632
Коммит
8ad057c2c7
@@ -105,11 +105,12 @@ export default class Sidebar extends React.Component {
|
|||||||
const preferences = getMyPreferences(store.getState());
|
const preferences = getMyPreferences(store.getState());
|
||||||
const profiles = getUsers(store.getState());
|
const profiles = getUsers(store.getState());
|
||||||
let displayableChannels = {};
|
let displayableChannels = {};
|
||||||
if (channels !== this.oldChannels ||
|
if (!Utils.areObjectsEqual(channels, this.oldChannels) ||
|
||||||
preferences !== this.oldPreferences ||
|
!Utils.areObjectsEqual(preferences, this.oldPreferences) ||
|
||||||
profiles !== this.oldProfiles) {
|
!Utils.areObjectsEqual(profiles, this.oldProfiles)) {
|
||||||
const channelsArray = channels.map((channel) => Object.assign({}, channel));
|
const channelsArray = channels.map((channel) => Object.assign({}, channel));
|
||||||
displayableChannels = ChannelUtils.buildDisplayableChannelList(channelsArray);
|
displayableChannels = ChannelUtils.buildDisplayableChannelList(channelsArray);
|
||||||
|
displayableChannels.favoriteChannels.sort(sortTeamsByDisplayName);
|
||||||
}
|
}
|
||||||
this.oldChannels = channels;
|
this.oldChannels = channels;
|
||||||
this.oldPreferences = preferences;
|
this.oldPreferences = preferences;
|
||||||
@@ -641,7 +642,6 @@ export default class Sidebar extends React.Component {
|
|||||||
|
|
||||||
// create elements for all 4 types of channels
|
// create elements for all 4 types of channels
|
||||||
const favoriteItems = this.state.favoriteChannels.
|
const favoriteItems = this.state.favoriteChannels.
|
||||||
sort(sortTeamsByDisplayName).
|
|
||||||
map((channel, index, arr) => {
|
map((channel, index, arr) => {
|
||||||
if (channel.type === Constants.DM_CHANNEL) {
|
if (channel.type === Constants.DM_CHANNEL) {
|
||||||
return this.createChannelElement(channel, index, arr, this.handleLeaveDirectChannel);
|
return this.createChannelElement(channel, index, arr, this.handleLeaveDirectChannel);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user