fix: [code-1121]: fix file redirection in commits view (#847)

This commit is contained in:
Calvin Lee 2023-11-30 19:17:42 +00:00 committed by Harness
parent 03b33aca77
commit b78a25a337
2 changed files with 5 additions and 3 deletions

View File

@ -289,7 +289,6 @@ export const Changes: React.FC<ChangesProps> = ({
)
useShowRequestError(errorActivities || errorFileViews)
return (
<Container className={cx(css.container, className)} {...(!!loading || !!error ? { flex: true } : {})}>
<LoadingSpinner visible={loading || showSpinner} withBorder={true} />
@ -395,6 +394,7 @@ export const Changes: React.FC<ChangesProps> = ({
sourceRef={_sourceRef}
commitRange={commitRange}
scrollElement={scrollElement}
commitSHA={commitSHA}
/>
))}
</Layout.Vertical>

View File

@ -85,6 +85,7 @@ interface DiffViewerProps extends Pick<GitInfoProps, 'repoMetadata'> {
sourceRef?: string
commitRange?: string[]
scrollElement: HTMLElement
commitSHA?: string
}
//
@ -103,7 +104,8 @@ export const DiffViewer: React.FC<DiffViewerProps> = ({
targetRef,
sourceRef,
commitRange,
scrollElement
scrollElement,
commitSHA
}) => {
const { routes, routingId } = useAppContext()
const { getString } = useStrings()
@ -690,7 +692,7 @@ export const DiffViewer: React.FC<DiffViewerProps> = ({
<Link
to={routes.toCODERepository({
repoPath: repoMetadata.path as string,
gitRef: pullRequestMetadata?.source_branch,
gitRef: pullRequestMetadata?.source_branch || commitSHA || '',
resourcePath: diff.isRename ? diff.newName : diff.filePath
})}>
{diff.isRename ? `${diff.oldName} -> ${diff.newName}` : diff.filePath}