From f2647505fb3cb4bd76a7bdad538beb8f35baece1 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 1 Mar 2017 13:23:55 +0100 Subject: [PATCH] SONAR-8451 fix bad state on measures page --- .../src/main/js/apps/component-measures/app/App.js | 7 ++++--- .../src/main/js/apps/component-measures/home/actions.js | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) 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); -- 2.39.5