From 21271a6dedae4816ffc7eaeb8becb14cec1782ef Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 10:22:16 -0700 Subject: [PATCH] fix data source picker for alerts card (#1149) (#1150) (cherry picked from commit 20b50b51e5b411f36b360ba0232b116043563d60) Signed-off-by: Joanne Wang Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx b/public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx index 00b2e395..77f9089c 100644 --- a/public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx +++ b/public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx @@ -49,7 +49,7 @@ export const DataSourceAlertsCard: React.FC = ({ get }, [dataSource]); const onDataSourceSelected = useCallback((options: any[]) => { - if (dataSource?.id !== undefined && dataSource?.id !== options[0]?.id) { + if (dataSource?.id === undefined || dataSource?.id !== options[0]?.id) { setDataSource(options[0]); } }, [dataSource]);