diff --git a/src/dashboard/dashboard.js b/src/dashboard/dashboard.js index 8ed06ac..7eebb2a 100644 --- a/src/dashboard/dashboard.js +++ b/src/dashboard/dashboard.js @@ -177,11 +177,22 @@ 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 (this.state.ics !== undefined && !Dashboard.webSocketsOpened) { - if (this.state.ics.length > 0) { - console.log("Starting to open IC websockets:", this.state.ics); + // only open sockets of ICs with configured input or output signals + let relevantICs = this.state.ics.filter(ic => { + let result = false; + this.state.configs.forEach(config => { + if(ic.id === config.icID && (config.inputLength !== 0 || config.outputLength !== 0)){ + result = true; + } + }) + return result; + }) + + if (relevantICs.length > 0) { + console.log("Starting to open IC websockets:", relevantICs); AppDispatcher.dispatch({ type: 'ics/open-sockets', - data: this.state.ics + data: relevantICs }); Dashboard.webSocketsOpened = true;