Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle no option available case when local body returns empty response #7359

Merged
merged 4 commits into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Components/Form/SelectMenuV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ const SelectMenuV2 = <T, V>(props: SelectMenuProps<T, V>) => {

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: <p className="font-normal text-gray-600">{placeholder}</p>,
Expand All @@ -77,7 +78,7 @@ const SelectMenuV2 = <T, V>(props: SelectMenuProps<T, V>) => {
return (
<div className={props.className} id={props.id}>
<Listbox
disabled={props.disabled}
disabled={props.disabled || valueOptions?.length === 0}
value={value}
onChange={(selection: any) => props.onChange(selection.value)}
>
Expand Down
Loading