Skip to content

Commit b207d09

Browse files
OnSearch Bug fix
1 parent d699ca1 commit b207d09

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/lib/multi-select/SelectionList.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,12 @@ const SelectionList = (props: SelectionListPropType): JSX.Element => {
3636
list?.length > 0 && ((hideSelected && list.filter((e) => !e.status || e.status === PRODUCT_UNSELECTED_STATUS)?.length > 0) || !hideSelected)
3737
), [list]);
3838
const searchValue = (value: string): void => {
39-
if (onSearch?.name === 'mockConstructor') {
40-
const products = [...productList];
41-
setList(products.filter((e) => e.name.indexOf(value) !== -1));
42-
}
43-
else if (onSearch) {
39+
if (onSearch) {
4440
onSearch(value);
41+
return;
4542
}
43+
const products = [...productList];
44+
setList(products.filter((e) => e.name.indexOf(value) !== -1));
4645
}
4746

4847
const changeStatus = (index: number): void => {

src/lib/multi-select/types.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export interface MultiSelectPropType {
33
showCheckbox?: boolean,
44
hideSelected?: boolean,
55
hideSearch?: boolean,
6-
onSearch?: (value: string) => void,
6+
onSearch?(value: string): void,
77
setSelectedValues?: (values: eachProductType[]) => {},
88
searchPlaceholder?: string,
99
zeroState?: {

0 commit comments

Comments
 (0)