From 4f5b5ea6b8eb91b6ccbfade5a47e7abcabccbead Mon Sep 17 00:00:00 2001 From: Gandharv Date: Sat, 7 May 2022 13:31:36 +0530 Subject: [PATCH] Fixes new added/deleted query doesnt update on query manager (#3001) --- frontend/src/Editor/Editor.jsx | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/frontend/src/Editor/Editor.jsx b/frontend/src/Editor/Editor.jsx index befd893bbc..28d72cc313 100644 --- a/frontend/src/Editor/Editor.jsx +++ b/frontend/src/Editor/Editor.jsx @@ -393,22 +393,30 @@ class Editor extends React.Component { }; dataSourcesChanged = () => { - this.socket.send( - JSON.stringify({ - event: 'events', - data: { message: 'dataSourcesChanged', appId: this.state.appId }, - }) - ); + if (this.socket instanceof WebSocket) { + this.socket?.send( + JSON.stringify({ + event: 'events', + data: { message: 'dataSourcesChanged', appId: this.state.appId }, + }) + ); + } else { + this.fetchDataSources(); + } }; dataQueriesChanged = () => { this.setState({ addingQuery: false }, () => { - this.socket.send( - JSON.stringify({ - event: 'events', - data: { message: 'dataQueriesChanged', appId: this.state.appId }, - }) - ); + if (this.socket instanceof WebSocket) { + this.socket?.send( + JSON.stringify({ + event: 'events', + data: { message: 'dataQueriesChanged', appId: this.state.appId }, + }) + ); + } else { + this.fetchDataQueries(); + } }); };