diff --git a/public/app/features/query/components/QueryGroup.tsx b/public/app/features/query/components/QueryGroup.tsx index 8c4c5b65089..6bb3d3789ea 100644 --- a/public/app/features/query/components/QueryGroup.tsx +++ b/public/app/features/query/components/QueryGroup.tsx @@ -167,8 +167,13 @@ export class QueryGroup extends PureComponent { this.setState({ scrollTop: 1000 }); }; + onUpdateAndRun = (options: QueryGroupOptions) => { + this.props.onOptionsChange(options); + this.props.onRunQueries(); + }; + renderTopSection(styles: QueriesTabStyls) { - const { onOpenQueryInspector, options, onOptionsChange } = this.props; + const { onOpenQueryInspector, options } = this.props; const { dataSource, data } = this.state; return ( @@ -199,7 +204,7 @@ export class QueryGroup extends PureComponent { options={options} dataSource={dataSource} data={data} - onChange={onOptionsChange} + onChange={this.onUpdateAndRun} /> {onOpenQueryInspector && ( diff --git a/public/app/features/query/components/QueryGroupOptions.tsx b/public/app/features/query/components/QueryGroupOptions.tsx index ca31fef73e2..abd630de8d9 100644 --- a/public/app/features/query/components/QueryGroupOptions.tsx +++ b/public/app/features/query/components/QueryGroupOptions.tsx @@ -144,19 +144,23 @@ export class QueryGroupOptionsEditor extends PureComponent { maxDataPoints = null; } - onChange({ - ...options, - maxDataPoints: maxDataPoints, - }); + if (maxDataPoints !== options.maxDataPoints) { + onChange({ + ...options, + maxDataPoints, + }); + } }; onMinIntervalBlur = (event: ChangeEvent) => { const { options, onChange } = this.props; - - onChange({ - ...options, - minInterval: emptyToNull(event.target.value), - }); + const minInterval = emptyToNull(event.target.value); + if (minInterval !== options.minInterval) { + onChange({ + ...options, + minInterval, + }); + } }; renderCacheTimeoutOption() {