mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
QueryEditor: Don't use _.defaults as it mutates the query prop directly (#37965)
* 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
This commit is contained in:
parent
65501cbad3
commit
7c97b9d03f
@ -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">
|
||||
|
Loading…
Reference in New Issue
Block a user