[v9.3.x] QueryEditorRow: Fixes issue loading query editor when data source variable selected (#62180)
QueryEditorRow: Fixes issue loading query editor when data source variable selected (#61927)
* QueryEditorRow: Fixes issue loading query editor when data source variable selected
* Fix func name
* Removed wait
* restore waiting for with better check
* restore waiting for with better check
(cherry picked from commit 9f7ddf1f0b)
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
This commit is contained in:
co-authored by
Torkel Ödegaard
parent
8e3111aa47
commit
ee1556e4fa
@@ -63,8 +63,10 @@ interface Props<TQuery extends DataQuery> {
|
||||
}
|
||||
|
||||
interface State<TQuery extends DataQuery> {
|
||||
/** DatasourceUid or ds variable expression used to resolve current datasource */
|
||||
loadedDataSourceIdentifier?: string | null;
|
||||
datasource: DataSourceApi<TQuery> | null;
|
||||
datasourceUid?: string | null;
|
||||
hasTextEditMode: boolean;
|
||||
data?: PanelData;
|
||||
isOpen?: boolean;
|
||||
@@ -238,17 +240,17 @@ export class QueryEditorRow<TQuery extends DataQuery> extends PureComponent<Prop
|
||||
}
|
||||
}
|
||||
|
||||
waitingForDatasourceToLoad = (): boolean => {
|
||||
isWaitingForDatasourceToLoad(): boolean {
|
||||
// if we not yet have loaded the datasource in state the
|
||||
// ds in props and the ds in state will have different values.
|
||||
return this.props.dataSource.uid !== this.state.datasource?.uid;
|
||||
};
|
||||
return this.props.dataSource.uid !== this.state.loadedDataSourceIdentifier;
|
||||
}
|
||||
|
||||
renderPluginEditor = () => {
|
||||
const { query, onChange, queries, onRunQuery, onAddQuery, app = CoreApp.PanelEditor, history } = this.props;
|
||||
const { datasource, data } = this.state;
|
||||
|
||||
if (this.waitingForDatasourceToLoad()) {
|
||||
if (this.isWaitingForDatasourceToLoad()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user