Commit 648a775a by David Kaltschmidt

Explore: Fix datasource selector being empty with single datasource

- The "missing" action was triggered unless the number of datasource >1 🤦
- Made datasource preselection more robust in case the requested datasource is already gone
parent af8425da
......@@ -161,11 +161,17 @@ export function initializeExplore(
},
});
if (exploreDatasources.length > 1) {
if (exploreDatasources.length >= 1) {
let instance;
if (datasource) {
instance = await getDatasourceSrv().get(datasource);
} else {
try {
instance = await getDatasourceSrv().get(datasource);
} catch (error) {
console.error(error);
}
}
// Checking on instance here because requested datasource could be deleted already
if (!instance) {
instance = await getDatasourceSrv().get();
}
dispatch(loadDatasource(exploreId, instance));
......
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