diff --git a/src/pages/CommitDetailPage/CommitCoverage/routes/IndirectChangesTab/IndirectChangesTable/CommitFileDiff/CommitFileDiff.jsx b/src/pages/CommitDetailPage/CommitCoverage/routes/IndirectChangesTab/IndirectChangesTable/CommitFileDiff/CommitFileDiff.jsx index b872fe7af8..9d4ed4ba99 100644 --- a/src/pages/CommitDetailPage/CommitCoverage/routes/IndirectChangesTab/IndirectChangesTable/CommitFileDiff/CommitFileDiff.jsx +++ b/src/pages/CommitDetailPage/CommitCoverage/routes/IndirectChangesTab/IndirectChangesTable/CommitFileDiff/CommitFileDiff.jsx @@ -36,98 +36,6 @@ const Loader = () => ( ) -const NewDiffRenderer = ({ - headName, - hashedPath, - segments, - ignoredUploadIds, -}) => { - return segments?.map((segment, segmentIndex) => { - let content = '' - const lineData = [] - segment.lines.forEach((line, lineIndex) => { - content += line.content - - if (lineIndex < segment.lines.length - 1) { - content += '\n' - } - - lineData.push({ - headNumber: line?.headNumber, - baseNumber: line?.baseNumber, - headCoverage: line?.headCoverage, - baseCoverage: line?.baseCoverage, - hitCount: without(line?.coverageInfo?.hitUploadIds, ...ignoredUploadIds) - .length, - }) - }) - - return ( - - ) - }) -} - -const OldDiffRenderer = ({ - headName, - fileLabel, - fullFilePath, - segments, - ignoredUploadIds, - stickyPadding, - comparisonData, -}) => { - return segments?.map((segment, segmentIndex) => { - const content = segment.lines.map((line) => line.content).join('\n') - return ( - - -
-
- {segment?.header} - {fileLabel && ( - {fileLabel} - )} -
- - View full file - -
-
- ( - = segment.lines.length - 3} - path={comparisonData?.hashedPath} - hitCount={ - without( - segment?.lines?.[i]?.coverageInfo?.hitUploadIds, - ...ignoredUploadIds - ).length - } - stickyPadding={stickyPadding} - {...props} - {...segment.lines[i]} - /> - )} - /> -
- ) - }) -} - function CommitFileDiff({ path }) { const { commitFileDiff } = useNavLinks() const { owner, repo, provider, commit } = useParams() @@ -172,24 +80,83 @@ function CommitFileDiff({ path }) { return ( <> {isCriticalFile && } - {virtualDiffRenderer ? ( - - ) : ( - - )} + {segments?.map((segment, segmentIndex) => { + const content = segment.lines.map((line) => line.content).join('\n') + + let newDiffContent = '' + const lineData = [] + if (virtualDiffRenderer) { + segment.lines.forEach((line, lineIndex) => { + newDiffContent += line.content + + if (lineIndex < segment.lines.length - 1) { + newDiffContent += '\n' + } + + lineData.push({ + headNumber: line?.headNumber, + baseNumber: line?.baseNumber, + headCoverage: line?.headCoverage, + baseCoverage: line?.baseCoverage, + hitCount: without( + line?.coverageInfo?.hitUploadIds, + ...ignoredUploadIds + ).length, + }) + }) + } + + return ( + + +
+
+ {segment?.header} + {fileLabel && ( + {fileLabel} + )} +
+ + View full file + +
+
+ {virtualDiffRenderer ? ( + + ) : ( + ( + = segment.lines.length - 3} + path={comparisonData?.hashedPath} + hitCount={ + without( + segment?.lines?.[i]?.coverageInfo?.hitUploadIds, + ...ignoredUploadIds + ).length + } + stickyPadding={stickyPadding} + {...props} + {...segment.lines[i]} + /> + )} + /> + )} +
+ ) + })} ) }