mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
display loading screen when changing team (#5325)
* display loading screen when changing team * fix lint error
This commit is contained in:
committed by
Joram Wilander
parent
829f3cce95
commit
11e0a7daa2
@@ -70,7 +70,9 @@ export default class ChannelView extends React.Component {
|
||||
<ChannelHeader
|
||||
channelId={this.state.channelId}
|
||||
/>
|
||||
<PostViewCache/>
|
||||
<PostViewCache
|
||||
channelId={this.state.channelId}
|
||||
/>
|
||||
<div
|
||||
className='post-create__container'
|
||||
id='post-create'
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// See License.txt for license information
|
||||
|
||||
import PostViewController from './post_view_controller.jsx';
|
||||
import LoadingScreen from 'components/loading_screen.jsx';
|
||||
|
||||
import ChannelStore from 'stores/channel_store.jsx';
|
||||
import UserStore from 'stores/user_store.jsx';
|
||||
@@ -67,25 +68,45 @@ export default class PostViewCache extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps) {
|
||||
return Boolean(nextProps.channelId);
|
||||
}
|
||||
|
||||
render() {
|
||||
const channels = this.state.channels;
|
||||
const currentChannelId = this.state.currentChannelId;
|
||||
|
||||
const valid = this.props.channelId === this.state.currentChannelId;
|
||||
const postViews = [];
|
||||
for (let i = 0; i < channels.length; i++) {
|
||||
postViews.push(
|
||||
<PostViewController
|
||||
key={'postviewcontroller_' + channels[i].id}
|
||||
channel={channels[i]}
|
||||
active={channels[i].id === currentChannelId}
|
||||
let content;
|
||||
|
||||
if (valid) {
|
||||
for (let i = 0; i < channels.length; i++) {
|
||||
postViews.push(
|
||||
<PostViewController
|
||||
key={'postviewcontroller_' + channels[i].id}
|
||||
channel={channels[i]}
|
||||
active={channels[i].id === currentChannelId}
|
||||
/>
|
||||
);
|
||||
}
|
||||
content = postViews;
|
||||
} else {
|
||||
content = (
|
||||
<LoadingScreen
|
||||
position='absolute'
|
||||
key='loading'
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div id='post-list'>
|
||||
{postViews}
|
||||
{content}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PostViewCache.propTypes = {
|
||||
channelId: React.PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user