Skip to content

Commit

Permalink
OnSearch Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aarathyKeyvalue committed Apr 26, 2023
1 parent d699ca1 commit b207d09
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/lib/multi-select/SelectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ const SelectionList = (props: SelectionListPropType): JSX.Element => {
list?.length > 0 && ((hideSelected && list.filter((e) => !e.status || e.status === PRODUCT_UNSELECTED_STATUS)?.length > 0) || !hideSelected)
), [list]);
const searchValue = (value: string): void => {
if (onSearch?.name === 'mockConstructor') {
const products = [...productList];
setList(products.filter((e) => e.name.indexOf(value) !== -1));
}
else if (onSearch) {
if (onSearch) {
onSearch(value);
return;
}
const products = [...productList];
setList(products.filter((e) => e.name.indexOf(value) !== -1));
}

const changeStatus = (index: number): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/multi-select/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export interface MultiSelectPropType {
showCheckbox?: boolean,
hideSelected?: boolean,
hideSearch?: boolean,
onSearch?: (value: string) => void,
onSearch?(value: string): void,
setSelectedValues?: (values: eachProductType[]) => {},
searchPlaceholder?: string,
zeroState?: {
Expand Down

0 comments on commit b207d09

Please sign in to comment.