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

This commit is contained in:
Ryan McKinley 2020-05-06 08:47:11 -07:00 committed by GitHub
parent d747fcf9c3
commit 1896828bd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,8 +57,13 @@ export class QueryEditorRows extends PureComponent<Props> {
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(