Skip to content

Commit

Permalink
carol/ Search box hotfix (#5749)
Browse files Browse the repository at this point in the history
* search hotfix

* search hotfix

* fix: intermittent issue
  • Loading branch information
carolsachdeva authored Jun 20, 2022
1 parent 9db1289 commit 3b54f8a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/p2p/src/components/search-box/search-box.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@ const SearchBox = ({ className, onClear, onSearch, placeholder }) => {
}
};

const onSearchKeyUp = submitForm => {
const onSearchKeyUpDown = submitForm => {
clearTimeout(typing_timer);

const typing_timer = setTimeout(() => {
submitForm();
}, 1000);
}, 500);
};

const onSearchSubmit = ({ search }) => {
if (!search.trim()) {
if (typeof onClear === 'function') {
onClear();
}
return;
}

Expand All @@ -44,7 +47,8 @@ const SearchBox = ({ className, onClear, onSearch, placeholder }) => {
type='text'
name='search'
placeholder={placeholder}
onKeyUp={() => onSearchKeyUp(submitForm)}
onKeyDown={() => onSearchKeyUpDown(submitForm)}
onKeyUp={() => onSearchKeyUpDown(submitForm)}
onFocus={submitForm}
leading_icon={<Icon className='search-box__field-icon' icon='IcSearch' />}
trailing_icon={
Expand Down

1 comment on commit 3b54f8a

@vercel
Copy link

@vercel vercel bot commented on 3b54f8a Jun 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

deriv-app – ./

deriv-app.vercel.app
deriv-app.binary.sx
deriv-app-git-master.binary.sx
binary.sx

Please sign in to comment.