diff options
author | Mathieu Suen <mathieu.suen@sonarsource.com> | 2022-11-15 11:31:58 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-11-16 20:03:06 +0000 |
commit | cd212e79054b3adac35240fb6108491222785e8e (patch) | |
tree | 4f746322f3ac131fd48d9389c9cc0348cb1fe914 | |
parent | e66468ca6660c2517f87f576f8f8a58493997c45 (diff) | |
download | sonarqube-cd212e79054b3adac35240fb6108491222785e8e.tar.gz sonarqube-cd212e79054b3adac35240fb6108491222785e8e.zip |
SONAR-17594 Remove issue message that appears as secondary issue whilst being the primary
-rw-r--r-- | server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx | 8 |
1 files 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 <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} |