diff --git a/js/api.js b/js/api.js
index 6112c0d..0cee469 100644
--- a/js/api.js
+++ b/js/api.js
@@ -344,6 +344,7 @@ const reducerTournamentStatistics = (state = defaultStateTournamentStatistics, a
storeOptionalToken(error.response);
}
action.parameters.errorCallback();
+ return Object.assign({}, state, {loaded: true});
});
return state;
case actionTypesTournamentStatistics.INT_REQUEST_TOURNAMENT_STATISTICS:
@@ -361,11 +362,12 @@ const reducerTournamentStatistics = (state = defaultStateTournamentStatistics, a
storeOptionalToken(error.response);
}
action.parameters.errorCallback();
+ return Object.assign({}, state, {loaded: true});
});
- return Object.assign({}, state, action.parameters.tournamentInfo);
+ return Object.assign({}, state, action.parameters.tournamentInfo, {loaded: true});
case actionTypesTournamentStatistics.REQUEST_TOURNAMENT_STATISTICS_SUCCESS:
action.parameters.successCallback();
- return Object.assign({}, state, action.parameters.tournamentStatistics);
+ return Object.assign({}, state, action.parameters.tournamentStatistics, {loaded: true});
default: return state;
}
};
diff --git a/js/redux/tournamentStatistics.js b/js/redux/tournamentStatistics.js
index 4004982..0f4884c 100644
--- a/js/redux/tournamentStatistics.js
+++ b/js/redux/tournamentStatistics.js
@@ -16,6 +16,7 @@ export const defaultStateTournamentStatistics = {
owner_username: '',
isPublic: '',
+ loaded: false,
statistics_available: false,
most_dominant_team: {},
diff --git a/pages/tournament-statistics.js b/pages/tournament-statistics.js
index 0beb23b..afbfbc2 100644
--- a/pages/tournament-statistics.js
+++ b/pages/tournament-statistics.js
@@ -11,6 +11,7 @@ import {requestTournamentStatistics} from '../js/api';
import {EditButton, TournamentStatusBar, TournamentStatusBarButton} from '../js/components/TournamentStatusBar';
import Navbar from 'react-bootstrap/Navbar';
import {TournamentBigImage} from '../js/components/TournamentBigImage';
+import {LoadingPage} from '../js/components/LoadingPage';
class StatisticsTournamentPage extends React.Component {
static async getInitialProps({query}) {
@@ -24,6 +25,10 @@ class StatisticsTournamentPage extends React.Component {
render() {
const {tournamentStatistics} = this.props;
+ if (!tournamentStatistics.loaded) {
+ return