mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
refactor: change the approach of onSubmit prop function passing
instead of arrow function we pass just queryOnsubmit and retrieve the event from the function itself
This commit is contained in:
parent
19207937f1
commit
b7e77417b4
1 changed files with 3 additions and 2 deletions
|
|
@ -59,8 +59,9 @@ const SearchBar = React.memo(({ className, query, active }) => {
|
|||
}
|
||||
}, [createTorrentFromMagnet]);
|
||||
|
||||
const queryInputOnSubmit = React.useCallback((searchValue, event) => {
|
||||
const queryInputOnSubmit = React.useCallback((event) => {
|
||||
event.preventDefault();
|
||||
const searchValue = `/search?search=${event.target.value}`;
|
||||
setCurrentQuery(searchValue);
|
||||
if (searchInputRef.current && searchValue) {
|
||||
window.location.hash = searchValue;
|
||||
|
|
@ -107,7 +108,7 @@ const SearchBar = React.memo(({ className, query, active }) => {
|
|||
defaultValue={query}
|
||||
tabIndex={-1}
|
||||
onChange={queryInputOnChange}
|
||||
onSubmit={(e) => queryInputOnSubmit(`/search?search=${e.target.value}`, e)}
|
||||
onSubmit={queryInputOnSubmit}
|
||||
onClick={openHistory}
|
||||
/>
|
||||
:
|
||||
|
|
|
|||
Loading…
Reference in a new issue