diff --git a/webapp/components/channel_info_modal.jsx b/webapp/components/channel_info_modal.jsx index 4c16dda90f..d44df40565 100644 --- a/webapp/components/channel_info_modal.jsx +++ b/webapp/components/channel_info_modal.jsx @@ -9,6 +9,17 @@ import {Modal} from 'react-bootstrap'; import React from 'react'; export default class ChannelInfoModal extends React.Component { + shouldComponentUpdate(nextProps) { + if (nextProps.show !== this.props.show) { + return true; + } + + if (!Utils.areObjectsEqual(nextProps.channel, this.props.channel)) { + return true; + } + + return false; + } render() { let channel = this.props.channel; if (!channel) { @@ -93,4 +104,4 @@ ChannelInfoModal.propTypes = { show: React.PropTypes.bool.isRequired, onHide: React.PropTypes.func.isRequired, channel: React.PropTypes.object.isRequired -}; \ No newline at end of file +}; diff --git a/webapp/components/channel_view.jsx b/webapp/components/channel_view.jsx index 45d0f2393c..6511d960a8 100644 --- a/webapp/components/channel_view.jsx +++ b/webapp/components/channel_view.jsx @@ -11,6 +11,8 @@ import PostsViewContainer from 'components/posts_view_container.jsx'; import ChannelStore from 'stores/channel_store.jsx'; +import * as Utils from 'utils/utils.jsx'; + export default class ChannelView extends React.Component { constructor(props) { super(props); @@ -47,6 +49,17 @@ export default class ChannelView extends React.Component { componentWillReceiveProps(nextProps) { this.setState(this.getStateFromStores(nextProps)); } + shouldComponentUpdate(nextProps, nextState) { + if (!Utils.areObjectsEqual(nextProps.params, this.props.params)) { + return true; + } + + if (nextState.channelId !== this.state.channelId) { + return true; + } + + return false; + } render() { return (
- +
; + } + + if (this.props.createAt === 0) { + return