@@ -15,6 +15,7 @@ import './Users.styles.css';
1515class Users extends Component {
1616 static propTypes = {
1717 loading : PropTypes . bool . isRequired ,
18+ connectionsLoading : PropTypes . bool . isRequired ,
1819 error : PropTypes . string ,
1920 users : PropTypes . array ,
2021 connections : PropTypes . array ,
@@ -44,7 +45,9 @@ class Users extends Component {
4445
4546 componentWillMount = ( ) => {
4647 this . props . fetchUsers ( ) ;
47- this . props . fetchConnections ( ) ;
48+ if ( ! this . props . connectionsLoading ) {
49+ this . props . fetchConnections ( ) ;
50+ }
4851 } ;
4952
5053 onPageChange = ( page ) => {
@@ -77,7 +80,7 @@ class Users extends Component {
7780 error,
7881 users,
7982 total,
80- connections ,
83+ connectionsLoading ,
8184 accessLevel,
8285 nextPage,
8386 pages,
@@ -102,7 +105,7 @@ class Users extends Component {
102105 < div className = "row content-header" >
103106 < div className = "col-xs-12 user-table-content" >
104107 < h1 > { languageDictionary . usersTitle || 'Users' } </ h1 >
105- { ( role > 0 && showCreateUser ) ?
108+ { ( ! connectionsLoading && role > 0 && showCreateUser ) ?
106109 < button id = "create-user-button" className = "btn btn-success pull-right new" onClick = { this . createUser } >
107110 < i className = "icon-budicon-473" > </ i >
108111 { languageDictionary . createUserButtonText || 'Create User' }
@@ -158,6 +161,7 @@ function mapStateToProps(state) {
158161 loading : state . users . get ( 'loading' ) ,
159162 users : state . users . get ( 'records' ) . toJS ( ) ,
160163 connections : state . connections . get ( 'records' ) . toJS ( ) ,
164+ connectionsLoading : state . connections . get ( 'loading' ) ,
161165 total : state . users . get ( 'total' ) ,
162166 nextPage : state . users . get ( 'nextPage' ) ,
163167 pages : state . users . get ( 'pages' ) ,
0 commit comments