From 1896828bd00341474b7e793e84500ac76be28d22 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Wed, 6 May 2020 08:47:11 -0700 Subject: [PATCH] QueryEditor: preserve the datasource attribute if when chaning queries (#24350) --- .../features/dashboard/panel_editor/QueryEditorRows.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/public/app/features/dashboard/panel_editor/QueryEditorRows.tsx b/public/app/features/dashboard/panel_editor/QueryEditorRows.tsx index 8dcc3963ec1..7364a140606 100644 --- a/public/app/features/dashboard/panel_editor/QueryEditorRows.tsx +++ b/public/app/features/dashboard/panel_editor/QueryEditorRows.tsx @@ -57,8 +57,13 @@ export class QueryEditorRows extends PureComponent { onChangeQuery(query: DataQuery, index: number) { const { queries, onChangeQueries } = this.props; - // ensure refId is maintained - query.refId = queries[index].refId; + const old = queries[index]; + + // ensure refId & datasource are maintained + query.refId = old.refId; + if (old.datasource) { + query.datasource = old.datasource; + } // update query in array onChangeQueries(