Colorize trace paths for choose without explicit default case (#9527)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Thomas Lovén 2021-07-08 00:15:20 +02:00 committed by GitHub
parent 137f8ad4cb
commit 979093923b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -143,8 +143,9 @@ class HatScriptGraph extends LitElement {
graphStart = false graphStart = false
) { ) {
const trace = this.trace.trace[path] as ChooseActionTraceStep[] | undefined; const trace = this.trace.trace[path] as ChooseActionTraceStep[] | undefined;
const trace_path = trace?.[0].result const trace_path =
? trace[0].result.choice === "default" trace !== undefined
? trace[0].result === undefined || trace[0].result.choice === "default"
? [Array.isArray(config.choose) ? config.choose.length : 0] ? [Array.isArray(config.choose) ? config.choose.length : 0]
: [trace[0].result.choice] : [trace[0].result.choice]
: []; : [];
@ -204,7 +205,9 @@ class HatScriptGraph extends LitElement {
<hat-graph-spacer <hat-graph-spacer
class=${classMap({ class=${classMap({
track: track:
trace !== undefined && trace[0].result?.choice === "default", trace !== undefined &&
(trace[0].result === undefined ||
trace[0].result.choice === "default"),
})} })}
></hat-graph-spacer> ></hat-graph-spacer>
${ensureArray(config.default)?.map((action, i) => ${ensureArray(config.default)?.map((action, i) =>