From cd212e79054b3adac35240fb6108491222785e8e Mon Sep 17 00:00:00 2001 From: Mathieu Suen Date: Tue, 15 Nov 2022 11:31:58 +0100 Subject: [PATCH] SONAR-17594 Remove issue message that appears as secondary issue whilst being the primary --- .../ComponentSourceSnippetGroupViewer.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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} -- 2.39.5