From 2b71cd330aa2ce332e328302189ea70b0e1cff86 Mon Sep 17 00:00:00 2001 From: Mohan Raj A Date: Tue, 2 Apr 2024 19:15:08 +0530 Subject: [PATCH] Handle no option available case when local body returns empty response (#7359) * Handle no option available case when result array is empty * Add Length check validation in rendering Select List * Add validation in the Select Component --- src/Components/Form/SelectMenuV2.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Components/Form/SelectMenuV2.tsx b/src/Components/Form/SelectMenuV2.tsx index 640f3163b9d..2c22510cef1 100644 --- a/src/Components/Form/SelectMenuV2.tsx +++ b/src/Components/Form/SelectMenuV2.tsx @@ -59,7 +59,8 @@ const SelectMenuV2 = (props: SelectMenuProps) => { const showChevronIcon = props.showChevronIcon ?? true; - const placeholder = props.placeholder ?? "Select"; + const placeholder = + valueOptions?.length > 0 ? props.placeholder ?? "Select" : "No options"; const defaultOption = { label: placeholder, selectedLabel:

{placeholder}

, @@ -77,7 +78,7 @@ const SelectMenuV2 = (props: SelectMenuProps) => { return (
props.onChange(selection.value)} >