mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Run test datasource query when mounted
This commit is contained in:
parent
1380fa54d6
commit
28b37e4df9
@ -1,4 +1,4 @@
|
||||
import React, { FormEvent, useMemo } from 'react';
|
||||
import React, { FormEvent, useEffect, useMemo } from 'react';
|
||||
import { useAsync } from 'react-use';
|
||||
|
||||
import { QueryEditorProps, SelectableValue } from '@grafana/data';
|
||||
@ -64,6 +64,12 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props)
|
||||
}));
|
||||
}, []);
|
||||
|
||||
// run the query once on mount using default selection
|
||||
useEffect(() => {
|
||||
onUpdate(query);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const onUpdate = (query: TestData) => {
|
||||
onChange(query);
|
||||
onRunQuery();
|
||||
|
Loading…
Reference in New Issue
Block a user