fix: datasources/dataqueries refresh post-addition (#3140)

This commit is contained in:
Gandharv 2022-05-27 14:16:29 +05:30 committed by GitHub
parent 5d076bc5fd
commit 8a7a1d21ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -408,8 +408,11 @@ class Editor extends React.Component {
this.initComponentVersioning();
};
/**
* https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/readyState
*/
dataSourcesChanged = () => {
if (this.socket instanceof WebSocket) {
if (this.socket instanceof WebSocket && this.socket?.readyState === WebSocket.OPEN) {
this.socket?.send(
JSON.stringify({
event: 'events',
@ -421,9 +424,12 @@ class Editor extends React.Component {
}
};
/**
* https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/readyState
*/
dataQueriesChanged = () => {
this.setState({ addingQuery: false }, () => {
if (this.socket instanceof WebSocket) {
if (this.socket instanceof WebSocket && this.socket?.readyState === WebSocket.OPEN) {
this.socket?.send(
JSON.stringify({
event: 'events',