mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Check if ICs are already loaded before attempting to open websockets
This commit is contained in:
parent
5d71bca954
commit
8a6de4b8cf
1 changed files with 10 additions and 7 deletions
|
@ -169,16 +169,19 @@ class Dashboard extends Component {
|
|||
|
||||
componentDidUpdate(prevProps: Readonly<P>, prevState: Readonly<S>, 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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue