[v9.0.x] QueryEditorRow: Fixes issue loading query editor when data source variable selected (#62657)

This commit is contained in:
Torkel Ödegaard
2023-02-01 17:23:59 +01:00
committed by GitHub
parent e46587c87b
commit eaffa2c21b
@@ -57,8 +57,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;
@@ -222,17 +224,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, app = CoreApp.PanelEditor, history } = this.props;
const { datasource, data } = this.state;
if (this.waitingForDatasourceToLoad()) {
if (this.isWaitingForDatasourceToLoad()) {
return null;
}