From d3cfb9ff13669341d6bd209f199f696981e13093 Mon Sep 17 00:00:00 2001 From: Yuan Tang Date: Mon, 1 May 2023 00:08:06 -0400 Subject: [PATCH] fix: UI crashes after submitting workflows Signed-off-by: Yuan Tang --- .../workflows/components/workflows-list/workflows-list.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/src/app/workflows/components/workflows-list/workflows-list.tsx b/ui/src/app/workflows/components/workflows-list/workflows-list.tsx index 3b72fab4791c..9c5a9589e5ec 100644 --- a/ui/src/app/workflows/components/workflows-list/workflows-list.tsx +++ b/ui/src/app/workflows/components/workflows-list/workflows-list.tsx @@ -76,7 +76,7 @@ export class WorkflowsList extends BasePage, State> { }); } if (this.state.selectedLabels) { - this.state.selectedLabels.forEach(label => { + this.state?.selectedLabels.forEach(label => { params.append('label', label); }); } @@ -314,7 +314,7 @@ export class WorkflowsList extends BasePage, State> { private countsByCompleted() { const counts = {complete: 0, incomplete: 0}; (this.state.workflows || []).forEach(wf => { - if (wf.metadata.labels && wf.metadata.labels[labels.completed] === 'true') { + if (wf.metadata?.labels && wf.metadata?.labels[labels.completed] === 'true') { counts.complete++; } else { counts.incomplete++; @@ -397,7 +397,7 @@ export class WorkflowsList extends BasePage, State> { checked={this.state.selectedWorkflows.has(wf.metadata.uid)} columns={this.state.columns} onChange={key => { - const value = `${key}=${wf.metadata.labels[key]}`; + const value = `${key}=${wf.metadata?.labels[key]}`; let newTags: string[] = []; if (this.state.selectedLabels.indexOf(value) === -1) { newTags = this.state.selectedLabels.concat(value);