File tree Expand file tree Collapse file tree
src/components/SuperAdmin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,15 +25,26 @@ const WrappedSuperAdminPane = WithCurrentUser(
2525
2626class SuperAdminContainer extends Component {
2727 componentDidMount ( ) {
28+ this . fetchDataIfReady ( ) ;
29+ }
30+
31+ componentDidUpdate ( prevProps ) {
32+ // Fetch data when user becomes available
33+ if ( ! prevProps . user && this . props . user ) {
34+ this . fetchDataIfReady ( ) ;
35+ }
36+ }
37+
38+ fetchDataIfReady = ( ) => {
2839 if ( window . env . REACT_APP_DISABLE_SUPER_ADMIN_METRICS !== "true" ) {
29- if ( AsManager ( this . props . user ) . isSuperUser ( ) ) {
40+ if ( this . props . user && AsManager ( this . props . user ) . isSuperUser ( ) ) {
3041 const searchQuery = { onlyEnabled : false } ;
3142 this . props . fetchAdminChallenges ( searchQuery ) ;
3243 this . props . fetchAdminProjects ( ) ;
3344 this . props . fetchAdminUsers ( ) ;
3445 }
3546 }
36- }
47+ } ;
3748
3849 render ( ) {
3950 if ( window . env . REACT_APP_DISABLE_SUPER_ADMIN_METRICS === "true" ) {
You can’t perform that action at this time.
0 commit comments