Skip to content

Commit eecc1ca

Browse files
fix: create new option incase of no exact match found (#1125)
1 parent 443b007 commit eecc1ca

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.changeset/poor-pots-speak.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ensembleui/react-runtime": patch
3+
---
4+
5+
fix: create new option incase of no exact match found

packages/runtime/src/widgets/Form/MultiSelect.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,8 @@ const MultiSelect: React.FC<MultiSelectProps> = (props) => {
228228
setSearchValue(value);
229229
return;
230230
}
231-
const isOptionExist = options.find(
232-
(option) =>
233-
option.label.toString().toLowerCase().search(value.toLowerCase()) > -1,
231+
const isOptionExist = options.some(
232+
(option) => option.label.toString().toLowerCase() === value.toLowerCase(),
234233
);
235234

236235
if (!isOptionExist && values?.allowCreateOptions) {

0 commit comments

Comments
 (0)