diff options
Diffstat (limited to 'server/sonar-web')
-rw-r--r-- | server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.js | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.js index 2abe61ee16d..acec2a25fa1 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.js @@ -73,7 +73,7 @@ export default class ProjectActivityAppContainer extends React.PureComponent { /*:: state: State; */ static contextTypes = { - router: PropTypes.object + router: PropTypes.object.isRequired }; constructor(props /*: Props */) { @@ -87,27 +87,25 @@ export default class ProjectActivityAppContainer extends React.PureComponent { metrics: [], query: parseQuery(props.location.query) }; + } + componentDidMount() { + this.mounted = true; + const elem = document.querySelector('html'); + elem && elem.classList.add('dashboard-page'); if (this.shouldRedirect()) { const newQuery = { ...this.state.query, graph: getGraph() }; if (isCustomGraph(newQuery.graph)) { newQuery.customMetrics = getCustomGraph(); } this.context.router.replace({ - pathname: props.location.pathname, + pathname: this.props.location.pathname, query: { ...serializeUrlQuery(newQuery), - branch: props.branch && getBranchName(props.branch) + branch: this.props.branch && getBranchName(this.props.branch) } }); - } - } - - componentDidMount() { - this.mounted = true; - const elem = document.querySelector('html'); - elem && elem.classList.add('dashboard-page'); - if (!this.shouldRedirect()) { + } else { this.firstLoadData(this.state.query); } } @@ -317,6 +315,10 @@ export default class ProjectActivityAppContainer extends React.PureComponent { }; render() { + if (this.shouldRedirect()) { + return null; + } + return ( <ProjectActivityApp addCustomEvent={this.addCustomEvent} |