Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

fix: bug 2356 #1404

Merged
merged 2 commits into from
Dec 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/routes/Apps/App/TrainDialogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,21 @@ class TrainDialogs extends React.Component<Props, ComponentState> {
this.props.trainDialogReplayThunkAsync as any,
)

// Get new activities to check for errors or warnings
const teachWithActivities = ((await this.props.fetchActivitiesThunkAsync(this.props.app.appId, newTrainDialog, this.props.user.name, this.props.user.id) as any) as Promise<CLM.TeachWithActivities>)
const replayError = DialogUtils.getMostSevereReplayError((await teachWithActivities).activities)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you have incorrect await statement due to wrong types above. Either way two awaits is weird and wouldn't recommend this syntax in inline awaits

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh.. Sloppy coding. thx

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. It's vscode that stuck that in. I typed "a", TAB for auto-complete, and....

vccode

if (replayError) {
if (replayError.errorLevel === CLM.ReplayErrorLevel.WARNING) {
newTrainDialog.validity = CLM.Validity.WARNING
}
else {
newTrainDialog.validity = CLM.Validity.INVALID
}
}
else {
newTrainDialog.validity = CLM.Validity.VALID
}

await ((this.props.trainDialogReplaceThunkAsync(this.props.app.appId, trainDialog.trainDialogId, newTrainDialog, false) as any) as Promise<void>)

// If user clicks 'Cancel' replay dialogs will be reset
Expand Down