* QueryEditor: Don't use _.defaults as it mutates the query prop directly
* QueryEditor: Update the query type on mount if none exists
* QueryEditor: Mutate in the constructor instead of render
* Apply defaults immutably in render
(cherry picked from commit 7c97b9d03f)
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
This commit is contained in:
co-authored by
Ashley Harrison
parent
44a659d1dc
commit
6c4f476597
@@ -1,5 +1,3 @@
|
||||
import { defaults } from 'lodash';
|
||||
|
||||
import React, { PureComponent } from 'react';
|
||||
import { InlineField, Select, Alert, Input } from '@grafana/ui';
|
||||
import { QueryEditorProps, SelectableValue, dataFrameFromJSON, rangeUtil } from '@grafana/data';
|
||||
@@ -245,7 +243,11 @@ export class QueryEditor extends PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const query = defaults(this.props.query, defaultQuery);
|
||||
const query = {
|
||||
...defaultQuery,
|
||||
...this.props.query,
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="gf-form">
|
||||
|
||||
Reference in New Issue
Block a user