From 9a170d9241e15dc02e6f07b6ad1dc7c0397daa3c Mon Sep 17 00:00:00 2001 From: "Wei-Chun, Chang" Date: Wed, 25 Oct 2023 12:04:07 +0800 Subject: [PATCH] Update git branch type and nullable handler Signed-off-by: Wei-Chun, Chang --- static_report/src/components/Reports/ReportContextBar.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static_report/src/components/Reports/ReportContextBar.tsx b/static_report/src/components/Reports/ReportContextBar.tsx index a3141ab29..b7e2f432d 100644 --- a/static_report/src/components/Reports/ReportContextBar.tsx +++ b/static_report/src/components/Reports/ReportContextBar.tsx @@ -30,7 +30,7 @@ export function ReportContextBar({ }: Props) { let datasource: string | undefined = undefined; let version: string | undefined = undefined; - let gitBranch: string | undefined = undefined; + let gitBranch: string | null | undefined = undefined; let githubPr: string | undefined = undefined; let githubPrUrl: string | undefined = undefined; let baseFrom: string | undefined = undefined; @@ -58,6 +58,8 @@ export function ReportContextBar({ report.input?.datasource.git_branch ) { gitBranch = `${report.base?.datasource.git_branch} ↔ ${report.input?.datasource.git_branch}`; + } else if (report.input?.datasource.git_branch) { + gitBranch = report.input?.datasource.git_branch; } if (report.metadata?.github_pr_id && report.metadata?.github_pr_url) {