]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-17594 Remove issue message that appears as secondary issue whilst being the...
authorMathieu Suen <mathieu.suen@sonarsource.com>
Tue, 15 Nov 2022 10:31:58 +0000 (11:31 +0100)
committersonartech <sonartech@sonarsource.com>
Wed, 16 Nov 2022 20:03:06 +0000 (20:03 +0000)
server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx

index d0ec15e8d2aebecea5e4eed403cc2280fdb75b44..2630d4b1adddf76221b06ea5d87dcf09708ae576 100644 (file)
@@ -220,8 +220,12 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
 
     const isFlow = issue.secondaryLocations.length === 0;
     const includeIssueLocation = isFlow ? isLastOccurenceOfPrimaryComponent : true;
-    const issuesForLine = issuesByLine[line.line] || [];
     const issueLocations = includeIssueLocation ? locations[line.line] : [];
+    const issuesForLine = (issuesByLine[line.line] || []).filter(
+      (issueForline) =>
+        issue.key !== issueForline.key ||
+        (issue.key === issueForline.key && issueLocations.length > 0)
+    );
 
     return (
       issuesForLine.length > 0 && (
@@ -232,7 +236,7 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone
               <IssueSourceViewerScrollContext.Consumer key={issueToDisplay.key}>
                 {(ctx) => (
                   <IssueMessageBox
-                    selected={!!(isSelectedIssue && issueLocations.length > 0)}
+                    selected={isSelectedIssue}
                     issue={issueToDisplay}
                     onClick={this.props.onIssueSelect}
                     ref={isSelectedIssue ? ctx?.registerPrimaryLocationRef : undefined}