From 648a775acbcaeb6fd57a97fdc5aedddcdc6948a3 Mon Sep 17 00:00:00 2001 From: David Kaltschmidt Date: Thu, 17 Jan 2019 12:07:42 +0100 Subject: [PATCH] Explore: Fix datasource selector being empty with single datasource - The "missing" action was triggered unless the number of datasource >1 :facepalm: - Made datasource preselection more robust in case the requested datasource is already gone --- public/app/features/explore/state/actions.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/public/app/features/explore/state/actions.ts b/public/app/features/explore/state/actions.ts index ae0bce6a019..256053d4c2e 100644 --- a/public/app/features/explore/state/actions.ts +++ b/public/app/features/explore/state/actions.ts @@ -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));