]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9698 Left-arrow to issues list doesn't scroll to right place
authorStas Vilchik <stas.vilchik@sonarsource.com>
Tue, 10 Oct 2017 15:50:55 +0000 (17:50 +0200)
committerStas Vilchik <stas.vilchik@sonarsource.com>
Wed, 11 Oct 2017 10:02:21 +0000 (12:02 +0200)
server/sonar-web/src/main/js/apps/issues/components/App.js

index 984aedca11c0b56dd23f9508e7d0314cd5b4fe6b..d0befcca5afaffcc40212043bad406a9bebd6588 100644 (file)
@@ -181,10 +181,13 @@ export default class App extends React.PureComponent {
       areMyIssuesSelected(prevQuery) !== areMyIssuesSelected(query)
     ) {
       this.fetchFirstIssues();
-    } else if (prevState.selected !== this.state.selected) {
-      if (!this.state.openIssue) {
-        this.scrollToSelectedIssue();
-      }
+    } else if (
+      !this.state.openIssue &&
+      (prevState.selected !== this.state.selected || prevState.openIssue != null)
+    ) {
+      // if user simply selected another issue
+      // or if he went from the source code back to the list of issues
+      this.scrollToSelectedIssue();
     }
   }