diff --git a/webapp/components/channel_view.jsx b/webapp/components/channel_view.jsx index 54d796ac10..4cca5aa98a 100644 --- a/webapp/components/channel_view.jsx +++ b/webapp/components/channel_view.jsx @@ -8,7 +8,6 @@ import PostsViewContainer from 'components/posts_view_container.jsx'; import CreatePost from 'components/create_post.jsx'; import ChannelStore from 'stores/channel_store.jsx'; -import UserStore from 'stores/user_store.jsx'; export default class ChannelView extends React.Component { constructor(props) { @@ -23,14 +22,12 @@ export default class ChannelView extends React.Component { getStateFromStores(props) { const channel = ChannelStore.getByName(props.params.channel); const channelId = channel ? channel.id : ''; - const profiles = JSON.parse(JSON.stringify(UserStore.getProfiles())); return { - channelId, - profiles + channelId }; } isStateValid() { - return this.state.channelId !== '' && this.state.profiles; + return this.state.channelId !== ''; } updateState() { this.setState(this.getStateFromStores(this.props)); @@ -44,13 +41,6 @@ export default class ChannelView extends React.Component { componentWillReceiveProps(nextProps) { this.setState(this.getStateFromStores(nextProps)); } - shouldComponentUpdate(nextProps, nextState) { - if (nextState.channelId !== this.state.channelId) { - return true; - } - - return false; - } render() { return (
- +
- {this.props.center} + {React.cloneElement(this.props.center, { + user: this.state.user, + profiles: this.state.profiles + })}
); diff --git a/webapp/components/permalink_view.jsx b/webapp/components/permalink_view.jsx index 2ebe523562..2c32d643d0 100644 --- a/webapp/components/permalink_view.jsx +++ b/webapp/components/permalink_view.jsx @@ -7,7 +7,6 @@ import ChannelHeader from 'components/channel_header.jsx'; import PostFocusView from 'components/post_focus_view.jsx'; import ChannelStore from 'stores/channel_store.jsx'; -import UserStore from 'stores/user_store.jsx'; import TeamStore from 'stores/team_store.jsx'; import {Link} from 'react-router'; @@ -30,17 +29,15 @@ export default class PermalinkView extends React.Component { const channelName = channel ? channel.name : ''; const team = TeamStore.getCurrent(); const teamName = team ? team.name : ''; - const profiles = JSON.parse(JSON.stringify(UserStore.getProfiles())); return { channelId, channelName, - profiles, teamName, postId }; } isStateValid() { - return this.state.channelId !== '' && this.state.profiles && this.state.teamName; + return this.state.channelId !== '' && this.state.teamName; } updateState() { this.setState(this.getStateFromStores(this.props)); @@ -56,21 +53,6 @@ export default class PermalinkView extends React.Component { componentWillReceiveProps(nextProps) { this.setState(this.getStateFromStores(nextProps)); } - shouldComponentUpdate(nextProps, nextState) { - if (nextState.postId !== this.state.postId) { - return true; - } - - if (nextState.channelId !== this.state.channelId) { - return true; - } - - if (nextState.teamName !== this.state.teamName) { - return true; - } - - return false; - } render() { if (!this.isStateValid()) { return null; @@ -83,7 +65,7 @@ export default class PermalinkView extends React.Component { - +