diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-04-29 08:40:06 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-04-29 08:40:06 -0400 |
commit | 1f4974dc02c786b65c802d4497fd736cca79d01c (patch) | |
tree | 1007e452c4a9345dee8aff113f28f235432bf323 /webapp/components/posts_view_container.jsx | |
parent | 9961ccca7d39bdfabbafce423d3f7fe4b6ed2f29 (diff) | |
download | chat-1f4974dc02c786b65c802d4497fd736cca79d01c.tar.gz chat-1f4974dc02c786b65c802d4497fd736cca79d01c.tar.bz2 chat-1f4974dc02c786b65c802d4497fd736cca79d01c.zip |
General react performance improvements (#2796)
* General React performance improvements
* Cleaned up unused props/state in PermaLinkView and PostFocusView
Diffstat (limited to 'webapp/components/posts_view_container.jsx')
-rw-r--r-- | webapp/components/posts_view_container.jsx | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/webapp/components/posts_view_container.jsx b/webapp/components/posts_view_container.jsx index edfa314f8..32b0aa578 100644 --- a/webapp/components/posts_view_container.jsx +++ b/webapp/components/posts_view_container.jsx @@ -1,12 +1,13 @@ // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. +import $ from 'jquery'; + import PostsView from './posts_view.jsx'; import LoadingScreen from './loading_screen.jsx'; import ChannelStore from 'stores/channel_store.jsx'; import PostStore from 'stores/post_store.jsx'; -import UserStore from 'stores/user_store.jsx'; import * as GlobalActions from 'action_creators/global_actions.jsx'; @@ -25,7 +26,6 @@ export default class PostsViewContainer extends React.Component { this.onChannelChange = this.onChannelChange.bind(this); this.onChannelLeave = this.onChannelLeave.bind(this); this.onPostsChange = this.onPostsChange.bind(this); - this.onUserChange = this.onUserChange.bind(this); this.handlePostsViewScroll = this.handlePostsViewScroll.bind(this); this.loadMorePostsTop = this.loadMorePostsTop.bind(this); this.handlePostsViewJumpRequest = this.handlePostsViewJumpRequest.bind(this); @@ -33,8 +33,7 @@ export default class PostsViewContainer extends React.Component { const currentChannelId = ChannelStore.getCurrentId(); const state = { scrollType: PostsView.SCROLL_TYPE_BOTTOM, - scrollPost: null, - currentUser: UserStore.getCurrentUser() + scrollPost: null }; if (currentChannelId) { Object.assign(state, { @@ -60,17 +59,14 @@ export default class PostsViewContainer extends React.Component { ChannelStore.addLeaveListener(this.onChannelLeave); PostStore.addChangeListener(this.onPostsChange); PostStore.addPostsViewJumpListener(this.handlePostsViewJumpRequest); - UserStore.addChangeListener(this.onUserChange); + $('body').addClass('app__body'); } componentWillUnmount() { ChannelStore.removeChangeListener(this.onChannelChange); ChannelStore.removeLeaveListener(this.onChannelLeave); PostStore.removeChangeListener(this.onPostsChange); PostStore.removePostsViewJumpListener(this.handlePostsViewJumpRequest); - UserStore.removeChangeListener(this.onUserChange); - } - onUserChange() { - this.setState({currentUser: UserStore.getCurrentUser()}); + $('body').removeClass('app__body'); } handlePostsViewJumpRequest(type, post) { switch (type) { @@ -171,7 +167,7 @@ export default class PostsViewContainer extends React.Component { const currentChannelId = channels[this.state.currentChannelIndex]; const channel = ChannelStore.get(currentChannelId); - if (!this.state.currentUser || !channel) { + if (!channel) { return null; } @@ -194,8 +190,6 @@ export default class PostsViewContainer extends React.Component { showMoreMessagesBottom={false} introText={channel ? createChannelIntroMessage(channel) : null} messageSeparatorTime={this.state.currentLastViewed} - profiles={this.props.profiles} - currentUser={this.state.currentUser} /> ); if (!postLists[i] && isActive) { @@ -215,7 +209,3 @@ export default class PostsViewContainer extends React.Component { ); } } - -PostsViewContainer.propTypes = { - profiles: React.PropTypes.object -}; |