Skip to content

Commit

Permalink
Fix omnibox search with long / matching string
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgelenas committed Apr 9, 2021
1 parent 4cc3e45 commit a189cc6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
"http": "^0.0.1-security",
"mkdirp": "^1.0.4",
"node-fetch": "^2.6.1",
"quick-score": "^0.0.11",
"quick-score": "0.0.10",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-intl": "^5.15.7",
Expand Down
9 changes: 5 additions & 4 deletions src/ui/components/Omnibox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ const Omnibox: FunctionComponent<OmniboxProps> = ({
values: Option[],
{ inputValue }: FilterOptionsState<Option>
): OptionWithMatches[] => {
return new QuickScore(values, ['label'])
.search(inputValue)
.map((result: { item: Option; matches: { label: number[][] } }) => {
const searchResults = new QuickScore(values, ['label']).search(inputValue);
return searchResults.map(
(result: { item: Option; matches: { label: number[][] } }) => {
return {
...result.item,
matches: result.matches.label,
};
});
}
);
};
return (
<Autocomplete
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12174,10 +12174,10 @@ quick-lru@^5.1.1:
resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932"
integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==

quick-score@^0.0.11:
version "0.0.11"
resolved "https://registry.yarnpkg.com/quick-score/-/quick-score-0.0.11.tgz#5116c071e6d4e4403d77366a4bef8e3c3bc1ea8a"
integrity sha512-uMuCjg0mOKkSCYTo0s0ta56XzlquufNMMQgM17MKiIxEFfGvnRzLCbZK9IlZBVYNqupQcMzhQgGVfrLSmI4UkA==
[email protected].10:
version "0.0.10"
resolved "https://registry.yarnpkg.com/quick-score/-/quick-score-0.0.10.tgz#4fa956b814ae7e3a2a7e94f7d0716dfa750639f8"
integrity sha512-IrDSAI00ifPkR4RjyJvf07hyfw+w2b6SuT18SQS8wOKMfYw4oIolf5wQliWkQ8OJTA7fOTYDzw7be/V3g+rsRA==

raf@^3.4.1:
version "3.4.1"
Expand Down

0 comments on commit a189cc6

Please sign in to comment.