Skip to content

Commit

Permalink
Optional chaining example usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobgy committed Feb 25, 2020
1 parent 9c98002 commit 1a9eaab
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions frontend/src/pages/GettingStarted.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,11 @@ export class GettingStarted extends Page<{}, { links: string[] }> {
.listPipelines(undefined, 10, undefined, createAndEncodeFilter(name))
.then(pipelineList => {
const pipelines = pipelineList.pipelines;
if (!pipelines || pipelines.length !== 1) {
if (pipelines?.length !== 1) {
// This should be accurate, do not accept ambiguous results.
return '';
}
const pipeline = pipelines[0];
if (!pipeline.id) {
return '';
}
return pipeline.id;
return pipelines[0].id || '';
})
.catch(() => ''),
),
Expand Down

0 comments on commit 1a9eaab

Please sign in to comment.