From: Mathieu Suen Date: Tue, 15 Nov 2022 10:31:58 +0000 (+0100) Subject: SONAR-17594 Remove issue message that appears as secondary issue whilst being the... X-Git-Tag: 9.8.0.63668~115 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cd212e79054b3adac35240fb6108491222785e8e;p=sonarqube.git SONAR-17594 Remove issue message that appears as secondary issue whilst being the primary --- diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx index d0ec15e8d2a..2630d4b1add 100644 --- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx +++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx @@ -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 {(ctx) => ( 0)} + selected={isSelectedIssue} issue={issueToDisplay} onClick={this.props.onIssueSelect} ref={isSelectedIssue ? ctx?.registerPrimaryLocationRef : undefined}