diff --git a/public/app/features/datasources/components/picker/BuiltInDataSourceList.tsx b/public/app/features/datasources/components/picker/BuiltInDataSourceList.tsx index 1c113403ef5..10f1ea14bcf 100644 --- a/public/app/features/datasources/components/picker/BuiltInDataSourceList.tsx +++ b/public/app/features/datasources/components/picker/BuiltInDataSourceList.tsx @@ -6,6 +6,7 @@ import { DataSourceRef } from '@grafana/schema'; import { useDatasources } from '../../hooks'; import { DataSourceCard } from './DataSourceCard'; +import { isDataSourceMatch } from './utils'; const CUSTOM_DESCRIPTIONS_BY_UID: Record = { grafana: 'Discover visualizations using mock data', @@ -30,7 +31,7 @@ export function BuiltInDataSourceList({ className, current, onChange }: BuiltInD key={ds.uid} ds={ds} description={CUSTOM_DESCRIPTIONS_BY_UID[ds.uid]} - selected={current === ds.id} + selected={isDataSourceMatch(ds, current)} onClick={() => onChange(ds)} /> ); diff --git a/public/app/features/datasources/components/picker/DataSourceList.tsx b/public/app/features/datasources/components/picker/DataSourceList.tsx index a5f317b006c..69efcf57c4f 100644 --- a/public/app/features/datasources/components/picker/DataSourceList.tsx +++ b/public/app/features/datasources/components/picker/DataSourceList.tsx @@ -86,7 +86,7 @@ export function DataSourceList(props: DataSourceListProps) { pushRecentlyUsedDataSource(ds); onChange(ds); }} - selected={!!isDataSourceMatch(ds, current)} + selected={isDataSourceMatch(ds, current)} {...(enableKeyboardNavigation ? navigatableProps : {})} /> ))} diff --git a/public/app/features/datasources/components/picker/utils.ts b/public/app/features/datasources/components/picker/utils.ts index 96edb7e5de6..16caea27c53 100644 --- a/public/app/features/datasources/components/picker/utils.ts +++ b/public/app/features/datasources/components/picker/utils.ts @@ -3,7 +3,7 @@ import { DataSourceInstanceSettings, DataSourceJsonData, DataSourceRef } from '@ export function isDataSourceMatch( ds: DataSourceInstanceSettings | undefined, current: string | DataSourceInstanceSettings | DataSourceRef | null | undefined -): boolean | undefined { +): boolean { if (!ds) { return false; }