Fix rendering of a choose without any action taken (#8952)

This commit is contained in:
Paulus Schoutsen 2021-04-22 12:01:09 -07:00 committed by GitHub
parent 0b8d356865
commit 5f78f18cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -314,16 +314,18 @@ class ActionRenderer {
if (defaultExecuted) { if (defaultExecuted) {
this._renderEntry(choosePath, `${name}: Default action executed`); this._renderEntry(choosePath, `${name}: Default action executed`);
} else { } else if (chooseTrace.result) {
const choiceConfig = this._getDataFromPath( const choiceConfig = this._getDataFromPath(
`${this.keys[index]}/choose/${chooseTrace.result?.choice}` `${this.keys[index]}/choose/${chooseTrace.result.choice}`
) as ChooseActionChoice | undefined; ) as ChooseActionChoice | undefined;
const choiceName = choiceConfig const choiceName = choiceConfig
? `${ ? `${
choiceConfig.alias || `Choice ${chooseTrace.result?.choice}` choiceConfig.alias || `Choice ${chooseTrace.result.choice}`
} executed` } executed`
: `Error: ${chooseTrace.error}`; : `Error: ${chooseTrace.error}`;
this._renderEntry(choosePath, `${name}: ${choiceName}`); this._renderEntry(choosePath, `${name}: ${choiceName}`);
} else {
this._renderEntry(choosePath, `${name}: No action taken`);
} }
let i; let i;