]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20498 Prevent issues from loading forever
authorJeremy Davis <jeremy.davis@sonarsource.com>
Tue, 19 Sep 2023 15:52:32 +0000 (17:52 +0200)
committersonartech <sonartech@sonarsource.com>
Tue, 26 Sep 2023 20:02:39 +0000 (20:02 +0000)
server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx

index 78aa3b0f2418f043e36c6a8abe97537e095f6891..53fb1308fd23796f77ef27acc9870a3a4032e11c 100644 (file)
@@ -155,6 +155,7 @@ const ISSUES_PAGE_SIZE = 100;
 
 export class App extends React.PureComponent<Props, State> {
   mounted = false;
+  requiresInitialFetch = false;
   bulkButtonRef: React.RefObject<HTMLButtonElement>;
 
   constructor(props: Props) {
@@ -222,6 +223,8 @@ export class App extends React.PureComponent<Props, State> {
 
     if (!this.props.isFetchingBranch) {
       this.fetchFirstIssues(true).catch(() => undefined);
+    } else {
+      this.requiresInitialFetch = true;
     }
   }
 
@@ -230,6 +233,12 @@ export class App extends React.PureComponent<Props, State> {
     const { query: prevQuery } = prevProps.location;
     const { openIssue } = this.state;
 
+    if (this.requiresInitialFetch && !this.props.isFetchingBranch) {
+      this.requiresInitialFetch = false;
+      this.fetchFirstIssues(true).catch(() => undefined);
+      return;
+    }
+
     if (
       prevProps.component !== this.props.component ||
       !isSameBranchLike(prevProps.branchLike, this.props.branchLike) ||