fix: [CODE-3280] update target ref in pr compare path (#3720)

* fix: [CODE-3280] update target ref in pr compare path
This commit is contained in:
Ritik Kapoor 2025-04-22 19:18:12 +00:00 committed by Harness
parent a73113f8e6
commit 0ba7be95fd
3 changed files with 10 additions and 4 deletions

View File

@ -50,7 +50,10 @@ export const RevertPRButton: React.FC<RevertPRButtonProps> = ({ pullRequestMetad
history.push(
routes.toCODECompare({
repoPath: repoMetadata?.path as string,
diffRefs: makeDiffRefs(pullRequestMetadata?.target_branch as string, data.branch)
diffRefs: makeDiffRefs(
(pullRequestMetadata?.target_branch ?? repoMetadata?.default_branch) as string,
data.branch
)
})
)
showSuccess(getString('pr.revertBranchSuccess', { branch: data.branch }), 3000)
@ -63,7 +66,10 @@ export const RevertPRButton: React.FC<RevertPRButtonProps> = ({ pullRequestMetad
history.push(
routes.toCODECompare({
repoPath: repoMetadata?.path as string,
diffRefs: makeDiffRefs(pullRequestMetadata?.target_branch as string, branchName)
diffRefs: makeDiffRefs(
(pullRequestMetadata?.target_branch ?? repoMetadata?.default_branch) as string,
branchName
)
})
)
}

View File

@ -105,7 +105,7 @@ export function FileContent({
history.replace(
routes.toCODECompare({
repoPath: repoMetadata.path as string,
diffRefs: makeDiffRefs(repoMetadata?.default_branch as string, newBranch)
diffRefs: makeDiffRefs((gitRef ?? repoMetadata?.default_branch) as string, newBranch)
})
)
} else {

View File

@ -247,7 +247,7 @@ function Editor({ resourceContent, repoMetadata, gitRef, resourcePath, isReposit
history.replace(
routes.toCODECompare({
repoPath: repoMetadata.path as string,
diffRefs: makeDiffRefs(repoMetadata?.default_branch as string, newBranch)
diffRefs: makeDiffRefs((gitRef ?? repoMetadata?.default_branch) as string, newBranch)
})
)
} else {