From: Grégoire Aubert Date: Fri, 10 Aug 2018 16:12:05 +0000 (+0200) Subject: SONAR-11149 Fix facets opening race conditions X-Git-Tag: 7.5~596 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9a9c7aba0c763a16390c0cf8e9d0a99588f31ed3;p=sonarqube.git SONAR-11149 Fix facets opening race conditions --- diff --git a/server/sonar-web/src/main/js/apps/issues/components/App.tsx b/server/sonar-web/src/main/js/apps/issues/components/App.tsx index e4486728c14..20ccf52504f 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/App.tsx @@ -451,10 +451,7 @@ export default class App extends React.PureComponent { Object.assign(parameters, { assignees: '__me__' }); } - return this.props.fetchIssues(parameters, requestOrganizations).then(reponse => { - this.setState({ loading: false }); - return reponse; - }); + return this.props.fetchIssues(parameters, requestOrganizations); }; fetchFirstIssues() { @@ -463,8 +460,9 @@ export default class App extends React.PureComponent { ({ facets, issues, paging, ...other }) => { if (this.mounted) { const openIssue = this.getOpenIssue(this.props, issues); - this.setState({ - facets: parseFacets(facets), + + this.setState(state => ({ + facets: { ...state.facets, ...parseFacets(facets) }, loading: false, issues, openIssue, @@ -476,7 +474,7 @@ export default class App extends React.PureComponent { selected: issues.length > 0 ? (openIssue ? openIssue.key : issues[0].key) : undefined, selectedFlowIndex: undefined, selectedLocationIndex: undefined - }); + })); } return issues; }, @@ -1040,10 +1038,10 @@ export default class App extends React.PureComponent { } renderPage() { - const { openIssue } = this.state; + const { loading, openIssue } = this.state; return (
- + {openIssue ? (