Use nullish coalescing operator instead of OR
Signed-off-by: Crevil <bjoern.soerensen@gmail.com>
This commit is contained in:
@@ -107,7 +107,7 @@ export const RecentWorkflowRunsCard = ({
|
||||
component={RouterLink}
|
||||
to={generatePath('./ci-cd/:id', { id: data.id! })}
|
||||
>
|
||||
{firstLine(data.message || '')}
|
||||
{firstLine(data.message ?? '')}
|
||||
</Link>
|
||||
),
|
||||
},
|
||||
|
||||
@@ -45,20 +45,20 @@ export const useWorkflowRunJobs = ({
|
||||
return {
|
||||
total_count: jobs.total_count,
|
||||
jobs: jobs.jobs.map<Job>(job => ({
|
||||
html_url: job.html_url || undefined,
|
||||
html_url: job.html_url ?? undefined,
|
||||
status: job.status,
|
||||
conclusion: job.conclusion || undefined,
|
||||
conclusion: job.conclusion ?? undefined,
|
||||
started_at: job.started_at,
|
||||
completed_at: job.completed_at || undefined,
|
||||
completed_at: job.completed_at ?? undefined,
|
||||
id: job.id,
|
||||
name: job.name,
|
||||
steps: job.steps?.map<Step>(step => ({
|
||||
name: step.name,
|
||||
status: step.status,
|
||||
conclusion: step.conclusion || undefined,
|
||||
conclusion: step.conclusion ?? undefined,
|
||||
number: step.number,
|
||||
started_at: step.started_at || undefined,
|
||||
completed_at: step.completed_at || undefined,
|
||||
started_at: step.started_at ?? undefined,
|
||||
completed_at: step.completed_at ?? undefined,
|
||||
})),
|
||||
})),
|
||||
};
|
||||
|
||||
@@ -75,7 +75,7 @@ export function useWorkflowRuns({
|
||||
setTotal(workflowRunsData.total_count);
|
||||
// Transformation here
|
||||
return workflowRunsData.workflow_runs.map(run => ({
|
||||
workflowName: run.name || undefined,
|
||||
workflowName: run.name ?? undefined,
|
||||
message: run.head_commit?.message,
|
||||
id: `${run.id}`,
|
||||
onReRunClick: async () => {
|
||||
@@ -91,17 +91,17 @@ export function useWorkflowRuns({
|
||||
}
|
||||
},
|
||||
source: {
|
||||
branchName: run.head_branch || undefined,
|
||||
branchName: run.head_branch ?? undefined,
|
||||
commit: {
|
||||
hash: run.head_commit?.id,
|
||||
url: run.head_repository?.branches_url?.replace(
|
||||
'{/branch}',
|
||||
run.head_branch || '',
|
||||
run.head_branch ?? '',
|
||||
),
|
||||
},
|
||||
},
|
||||
status: run.status || undefined,
|
||||
conclusion: run.conclusion || undefined,
|
||||
status: run.status ?? undefined,
|
||||
conclusion: run.conclusion ?? undefined,
|
||||
url: run.url,
|
||||
githubUrl: run.html_url,
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user