Commit 1896828b by Ryan McKinley Committed by GitHub

QueryEditor: preserve the datasource attribute if when chaning queries (#24350)

parent d747fcf9
...@@ -57,8 +57,13 @@ export class QueryEditorRows extends PureComponent<Props> { ...@@ -57,8 +57,13 @@ export class QueryEditorRows extends PureComponent<Props> {
onChangeQuery(query: DataQuery, index: number) { onChangeQuery(query: DataQuery, index: number) {
const { queries, onChangeQueries } = this.props; const { queries, onChangeQueries } = this.props;
// ensure refId is maintained const old = queries[index];
query.refId = queries[index].refId;
// ensure refId & datasource are maintained
query.refId = old.refId;
if (old.datasource) {
query.datasource = old.datasource;
}
// update query in array // update query in array
onChangeQueries( onChangeQueries(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment