Skip to content

Commit c92d05a

Browse files
committed
fix initial load of super admin page
1 parent 8ccdbbd commit c92d05a

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/components/SuperAdmin/SuperAdminContainer.jsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,26 @@ const WrappedSuperAdminPane = WithCurrentUser(
2525

2626
class 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") {

0 commit comments

Comments
 (0)