From 31c1fc3e6e2bc5c9b3b42c117e6997dc063fa6be Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Mon, 17 May 2021 17:48:04 +0200 Subject: [PATCH] Explore: Fix Cannot read property 'emit' of null error (#34114) * Use state.eventBridge for errors only if angular editor (some SQL data sources are still listening on this) * Update public/app/features/explore/state/query.ts * Update public/app/features/explore/state/query.ts --- public/app/features/explore/state/query.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/app/features/explore/state/query.ts b/public/app/features/explore/state/query.ts index c7a38911f17..13ca14bd7a5 100644 --- a/public/app/features/explore/state/query.ts +++ b/public/app/features/explore/state/query.ts @@ -660,8 +660,10 @@ export const processQueryResponse = ( return state; } - // For Angular editors - state.eventBridge.emit(PanelEvents.dataError, error); + // Send error to Angular editors + if (state.datasourceInstance?.components?.QueryCtrl) { + state.eventBridge.emit(PanelEvents.dataError, error); + } } if (!request) { @@ -673,7 +675,6 @@ export const processQueryResponse = ( // Send legacy data to Angular editors if (state.datasourceInstance?.components?.QueryCtrl) { const legacy = series.map((v) => toLegacyResponseData(v)); - state.eventBridge.emit(PanelEvents.dataReceived, legacy); }