Skip to content

Commit d8ef6be

Browse files
committed
Guard against null and undefined of lastRun
1 parent 31e7b77 commit d8ef6be

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • apps/webapp/app/routes/__app/orgs/$organizationSlug/__org

apps/webapp/app/routes/__app/orgs/$organizationSlug/__org/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,18 @@ function WorkflowList({
184184
}
185185

186186
function lastRunDescription(lastRun: WorkflowListItem["lastRun"]) {
187-
if (lastRun === undefined) {
187+
if (lastRun === null || lastRun === undefined) {
188188
return "Never";
189189
}
190+
190191
if (lastRun.status === "SUCCESS") {
191192
if (lastRun.finishedAt) {
192193
return formatDateTime(lastRun.finishedAt);
194+
} else {
195+
return "Unknown";
193196
}
194-
throw new Error("lastRun.finishedAt is undefined");
195197
}
198+
196199
return runStatusLabel(lastRun.status);
197200
}
198201

0 commit comments

Comments
 (0)