From: Stas Vilchik Date: Wed, 1 Mar 2017 12:23:55 +0000 (+0100) Subject: SONAR-8451 fix bad state on measures page X-Git-Tag: 6.3-RC4~21 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f2647505fb3cb4bd76a7bdad538beb8f35baece1;p=sonarqube.git SONAR-8451 fix bad state on measures page --- diff --git a/server/sonar-web/src/main/js/apps/component-measures/app/App.js b/server/sonar-web/src/main/js/apps/component-measures/app/App.js index f60a5aa0798..2381ba36011 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/app/App.js +++ b/server/sonar-web/src/main/js/apps/component-measures/app/App.js @@ -21,15 +21,16 @@ import React from 'react'; import Spinner from './../components/Spinner'; export default class App extends React.Component { + state = { componentSet: false }; + componentDidMount () { this.props.setComponent(this.props.component); this.props.fetchMetrics(); + this.setState({ componentSet: true }); } render () { - const { metrics } = this.props; - - if (metrics == null) { + if (this.props.metrics == null || !this.state.componentSet) { return ; } diff --git a/server/sonar-web/src/main/js/apps/component-measures/home/actions.js b/server/sonar-web/src/main/js/apps/component-measures/home/actions.js index b516d2e7bbb..a44cd01f8a9 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/home/actions.js +++ b/server/sonar-web/src/main/js/apps/component-measures/home/actions.js @@ -41,6 +41,8 @@ export function fetchMeasures () { dispatch(startFetching()); const state = getState(); + /* eslint-disable no-console */ + console.log(state); const component = getMeasuresAppComponent(state); const metrics = getMeasuresAppAllMetrics(state);