Commit 0c3c1759 by Torkel Ödegaard Committed by GitHub

QueryEditors: Fixes issue that happens after moving queries then editing would…

QueryEditors: Fixes issue that happens after moving queries then editing would update other queries (#31193)
parent 5218497a
...@@ -75,7 +75,7 @@ export class QueryEditorRow extends PureComponent<Props, State> { ...@@ -75,7 +75,7 @@ export class QueryEditorRow extends PureComponent<Props, State> {
} }
getAngularQueryComponentScope(): AngularQueryComponentScope { getAngularQueryComponentScope(): AngularQueryComponentScope {
const { query, onChange, onRunQuery, queries } = this.props; const { query, queries } = this.props;
const { datasource } = this.state; const { datasource } = this.state;
const panel = new PanelModel({ targets: queries }); const panel = new PanelModel({ targets: queries });
const dashboard = {} as DashboardModel; const dashboard = {} as DashboardModel;
...@@ -87,8 +87,10 @@ export class QueryEditorRow extends PureComponent<Props, State> { ...@@ -87,8 +87,10 @@ export class QueryEditorRow extends PureComponent<Props, State> {
dashboard: dashboard, dashboard: dashboard,
refresh: () => { refresh: () => {
// Old angular editors modify the query model and just call refresh // Old angular editors modify the query model and just call refresh
onChange(query); // Important that this use this.props here so that as this fuction is only created on mount and it's
onRunQuery(); // important not to capture old prop functions in this closure
this.props.onChange(query);
this.props.onRunQuery();
}, },
render: () => () => console.log('legacy render function called, it does nothing'), render: () => () => console.log('legacy render function called, it does nothing'),
events: new EventBusSrv(), events: new EventBusSrv(),
......
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