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(