Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2413 from botpress/ya-event-fix
fix(event): added some checks for parameters
- Loading branch information
Showing
4 changed files
with
53 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
modules/extensions/src/views/lite/components/debugger/views/Summary.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import sdk from 'botpress/sdk' | ||
import React from 'react' | ||
|
||
import Dialog from './Dialog' | ||
import NLU from './NLU' | ||
|
||
interface Props { | ||
event: sdk.IO.IncomingEvent | ||
} | ||
|
||
export default class Summary extends React.Component<Props> { | ||
state = { | ||
hasError: false | ||
} | ||
|
||
componentDidUpdate(prevProps) { | ||
if (prevProps.event !== this.props.event) { | ||
this.setState({ hasError: false }) | ||
} | ||
} | ||
|
||
static getDerivedStateFromError(error) { | ||
return { hasError: true } | ||
} | ||
|
||
render() { | ||
if (this.state.hasError) { | ||
return <div>Cannot display event summary</div> | ||
} | ||
|
||
return ( | ||
<div> | ||
<Dialog | ||
suggestions={this.props.event.suggestions} | ||
decision={this.props.event.decision} | ||
stacktrace={this.props.event.state.__stacktrace} | ||
/> | ||
<NLU session={this.props.event.state.session} nluData={this.props.event.nlu} /> | ||
</div> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters