Skip to content

Commit

Permalink
chore: fix crash (#746)
Browse files Browse the repository at this point in the history
Signed-off-by: Carina Ursu <[email protected]>
  • Loading branch information
ursucarina authored Apr 19, 2023
1 parent bbe8d51 commit 7e008cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/console/src/components/hooks/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function extractCompiledNodes(

return subWorkflows.reduce((out, subWorkflow) => {
return [...out, ...subWorkflow.template.nodes];
}, primary?.template?.nodes);
}, primary?.template?.nodes || []);
}

export function extractTaskTemplates(workflow: Workflow): TaskTemplate[] {
Expand All @@ -32,10 +32,11 @@ export function extractAndIdentifyNodes(
if (!workflow.closure || !workflow.closure.compiledWorkflow) {
return [];
}
const { primary, subWorkflows = [] } = workflow.closure.compiledWorkflow;
const { primary = {} as CompiledWorkflow, subWorkflows = [] } =
workflow.closure.compiledWorkflow;
const nodes = subWorkflows.reduce(
(out, subWorkflow) => [...out, ...subWorkflow.template.nodes],
primary.template.nodes,
primary?.template?.nodes || [],
);

return nodes.map(node => ({
Expand Down

0 comments on commit 7e008cf

Please sign in to comment.