fix(@cockpit/debugger): check if `debuggingContract` is undefined

Guard against redux-saga fetching races in `componentDidUpdate`.
This commit is contained in:
Michael Bradley, Jr 2019-07-09 12:53:59 -05:00 committed by Michael Bradley
parent 3f77272e71
commit 3590197c55
1 changed files with 1 additions and 1 deletions

View File

@ -81,7 +81,7 @@ class EditorContainer extends React.Component {
if(this.props.contracts.length && this.props.transaction) {
const debuggingContract = this.props.contracts.find(contract => contract.address === this.props.transaction.to)
if (this.state.debuggingContract !== debuggingContract) {
if (debuggingContract && this.state.debuggingContract !== debuggingContract) {
const editorWidth = this.getNewEditorWidth(OPERATIONS.LESS)
this.setState({currentAsideTab: TextEditorToolbarTabs.Debugger, editorWidth, debuggingContract})
this.props.fetchFile({path: debuggingContract.path});