Commit e7930a27 by Marcus Efraimsson Committed by GitHub

explore: add some extra time for angular query editors to update query (#16955)

Now when loading a query editor which changes the default query in the
constructor this will result in the actual updated query is used in
explore when running the query. Without this, the query used is sort
of out of sync between query editor and executed query.
parent 6dbaa704
...@@ -41,11 +41,15 @@ export default class QueryEditor extends PureComponent<QueryEditorProps, any> { ...@@ -41,11 +41,15 @@ export default class QueryEditor extends PureComponent<QueryEditorProps, any> {
datasource, datasource,
target, target,
refresh: () => { refresh: () => {
this.props.onQueryChange(target); setTimeout(() => {
this.props.onExecuteQuery(); this.props.onQueryChange(target);
this.props.onExecuteQuery();
}, 1);
}, },
onQueryChange: () => { onQueryChange: () => {
this.props.onQueryChange(target); setTimeout(() => {
this.props.onQueryChange(target);
}, 1);
}, },
events: exploreEvents, events: exploreEvents,
panel: { datasource, targets: [target] }, panel: { datasource, targets: [target] },
...@@ -54,7 +58,9 @@ export default class QueryEditor extends PureComponent<QueryEditorProps, any> { ...@@ -54,7 +58,9 @@ export default class QueryEditor extends PureComponent<QueryEditorProps, any> {
}; };
this.component = loader.load(this.element, scopeProps, template); this.component = loader.load(this.element, scopeProps, template);
this.props.onQueryChange(target); setTimeout(() => {
this.props.onQueryChange(target);
}, 1);
} }
componentDidUpdate(prevProps: QueryEditorProps) { componentDidUpdate(prevProps: QueryEditorProps) {
......
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