Skip to content

Commit

Permalink
Medibase Search: Skip showing selected option search results when que…
Browse files Browse the repository at this point in the history
…ry is present (ohcnetwork#6284)

* fixes ohcnetwork#6283; skip showing selected option in medibase search

* fix onblur
  • Loading branch information
rithviknishad authored Sep 19, 2023
1 parent 38bfe1a commit 9e9fa16
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Components/Form/FormFields/Autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export const Autocomplete = <T, V>(props: AutocompleteProps<T, V>) => {
placeholder={props.placeholder ?? "Select"}
displayValue={(value: any) => value?.label || ""}
onChange={(event) => setQuery(event.target.value.toLowerCase())}
onBlur={() => value && setQuery("")}
autoComplete="off"
/>
<Combobox.Button className="absolute inset-y-0 right-0 flex items-center pr-2">
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Medicine/MedibaseAutocompleteFormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function MedibaseAutocompleteFormField(
value={field.value}
required
onChange={field.handleChange}
options={options(field.value && [field.value])}
options={options(field.value && !query && [field.value])}
optionLabel={(option) => option.name.toUpperCase()}
optionDescription={(option) => <OptionDescription medicine={option} />}
optionValue={(option) => option}
Expand Down

0 comments on commit 9e9fa16

Please sign in to comment.