diff --git a/src/dashboard/dashboard.js b/src/dashboard/dashboard.js index ff3c135..d0708d8 100644 --- a/src/dashboard/dashboard.js +++ b/src/dashboard/dashboard.js @@ -169,16 +169,19 @@ class Dashboard extends Component { componentDidUpdate(prevProps: Readonly

, prevState: Readonly, snapshot: SS) { // open web sockets if ICs are already known and sockets are not opened yet - if(!Dashboard.webSocketsOpened && this.state.ics.length > 0){ - console.log("Starting to open IC websockets:", this.state.ics); - AppDispatcher.dispatch({ - type: 'ics/open-sockets', - data: this.state.ics - }); + if(this.state.ics !== undefined && !Dashboard.webSocketsOpened){ + if(this.state.ics.length > 0){ + console.log("Starting to open IC websockets:", this.state.ics); + AppDispatcher.dispatch({ + type: 'ics/open-sockets', + data: this.state.ics + }); - Dashboard.webSocketsOpened = true; + Dashboard.webSocketsOpened = true; + } } + if(prevState.dashboard === undefined && this.state.dashboard !== undefined){ // the dashboard was loaded, so that the scenarioID is available