From 863dbc7ba87d112bd699e78a601cbae8e5d3d394 Mon Sep 17 00:00:00 2001 From: Marcus Andersson Date: Wed, 2 Dec 2020 11:04:42 +0100 Subject: [PATCH] PanelEdit: making sure the correct datasource query editor is being rendered. (#29500) * making sure we try to use the selected db in the query row. * fixing so we use || instead of ??. --- public/app/features/query/components/QueryEditorRow.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/app/features/query/components/QueryEditorRow.tsx b/public/app/features/query/components/QueryEditorRow.tsx index 9465fd5b4e4..37ce76f2dd4 100644 --- a/public/app/features/query/components/QueryEditorRow.tsx +++ b/public/app/features/query/components/QueryEditorRow.tsx @@ -88,12 +88,13 @@ export class QueryEditorRow extends PureComponent { } async loadDatasource() { - const { query, panel } = this.props; + const { query, panel, dataSourceValue } = this.props; const dataSourceSrv = getDatasourceSrv(); let datasource; try { - datasource = await dataSourceSrv.get(query.datasource || panel.datasource); + const datasourceName = dataSourceValue || query.datasource || panel.datasource; + datasource = await dataSourceSrv.get(datasourceName); } catch (error) { datasource = await dataSourceSrv.get(); }