Skip to content

Commit

Permalink
fix: global search enter listener (#1797)
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarnaikjuspay authored Nov 25, 2024
1 parent 6af0622 commit ec03f6d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
12 changes: 0 additions & 12 deletions src/screens/Analytics/GlobalSearch/GlobalSearchBar.res
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,6 @@ let make = () => {
}
}

React.useEffect(() => {
let onKeyPress = event => {
let keyPressed = event->ReactEvent.Keyboard.key

if keyPressed == "Enter" {
selectedOption->redirectOnSelect
}
}
Window.addEventListener("keydown", onKeyPress)
Some(() => Window.removeEventListener("keydown", onKeyPress))
}, [])

let getCategoryOptions = async () => {
setState(_ => Loading)
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ module ModalSearchBox = {
| Some(val) => setSelectedOption(_ => val)
| _ => ()
}
} else if e->keyCode == 13 {
} else if e->keyCode == 13 && localSearchText->isNonEmptyString {
selectedOption->redirectOnSelect
}

Expand Down

0 comments on commit ec03f6d

Please sign in to comment.