diff --git a/src/components/trace/hat-script-graph.ts b/src/components/trace/hat-script-graph.ts index 4a42c5604e..815e7ba72c 100644 --- a/src/components/trace/hat-script-graph.ts +++ b/src/components/trace/hat-script-graph.ts @@ -143,11 +143,12 @@ class HatScriptGraph extends LitElement { graphStart = false ) { const trace = this.trace.trace[path] as ChooseActionTraceStep[] | undefined; - const trace_path = trace?.[0].result - ? trace[0].result.choice === "default" - ? [Array.isArray(config.choose) ? config.choose.length : 0] - : [trace[0].result.choice] - : []; + const trace_path = + trace !== undefined + ? trace[0].result?.choice === "default" || trace[0].result === undefined + ? [Array.isArray(config.choose) ? config.choose.length : 0] + : [trace[0].result.choice] + : []; return html` ${ensureArray(config.default)?.map((action, i) =>