diff --git a/src/components/trace/hat-script-graph.ts b/src/components/trace/hat-script-graph.ts index 156be802a..d347adad7 100644 --- a/src/components/trace/hat-script-graph.ts +++ b/src/components/trace/hat-script-graph.ts @@ -93,7 +93,7 @@ class HatScriptGraph extends LitElement { const path = `condition/${i}`; const trace = this.trace.trace[path] as ConditionTraceStep[] | undefined; const track_path = - trace === undefined ? 0 : trace![0].result.result ? 1 : 2; + trace?.[0].result === undefined ? 0 : trace[0].result.result ? 1 : 2; if (trace) { this.trackedNodes[path] = { config, path }; } @@ -139,7 +139,7 @@ class HatScriptGraph extends LitElement { private render_choose_node(config: ChooseAction, path: string) { const trace = this.trace.trace[path] as ChooseActionTraceStep[] | undefined; - const trace_path = trace + const trace_path = trace?.[0].result ? trace[0].result.choice === "default" ? [config.choose.length] : [trace[0].result.choice] @@ -173,7 +173,7 @@ class HatScriptGraph extends LitElement { .iconPath=${mdiCheckBoxOutline} nofocus class=${classMap({ - track: trace !== undefined && trace[0].result.choice === i, + track: trace !== undefined && trace[0].result?.choice === i, })} > ${branch.sequence.map((action, j) => @@ -188,7 +188,7 @@ class HatScriptGraph extends LitElement { nofocus class=${classMap({ track: - trace !== undefined && trace[0].result.choice === "default", + trace !== undefined && trace[0].result?.choice === "default", })} > ${config.default?.map((action, i) => @@ -200,8 +200,9 @@ class HatScriptGraph extends LitElement { } private render_condition_node(node: Condition, path: string) { - const trace: any = this.trace.trace[path]; - const track_path = trace === undefined ? 0 : trace[0].result.result ? 1 : 2; + const trace = (this.trace.trace[path] as ConditionTraceStep[]) || undefined; + const track_path = + trace?.[0].result === undefined ? 0 : trace[0].result.result ? 1 : 2; return html` ; } @@ -19,11 +20,11 @@ export interface TriggerTraceStep extends BaseTraceStep { } export interface ConditionTraceStep extends BaseTraceStep { - result: { result: boolean }; + result?: { result: boolean }; } export interface CallServiceActionTraceStep extends BaseTraceStep { - result: { + result?: { limit: number; running_script: boolean; params: Record; @@ -36,11 +37,11 @@ export interface CallServiceActionTraceStep extends BaseTraceStep { } export interface ChooseActionTraceStep extends BaseTraceStep { - result: { choice: number | "default" }; + result?: { choice: number | "default" }; } export interface ChooseChoiceActionTraceStep extends BaseTraceStep { - result: { result: boolean }; + result?: { result: boolean }; } export type ActionTraceStep = diff --git a/src/panels/logbook/ha-logbook.ts b/src/panels/logbook/ha-logbook.ts index 1fed1769b..cb77b90a9 100644 --- a/src/panels/logbook/ha-logbook.ts +++ b/src/panels/logbook/ha-logbook.ts @@ -259,7 +259,7 @@ class HaLogbook extends LitElement { haStyle, haStyleScrollbar, css` - :host { + :host([virtualize]) { display: block; height: 100%; }