Skip to content

Commit

Permalink
storybookjs#7711 cleanup search
Browse files Browse the repository at this point in the history
  • Loading branch information
LWilliamson1 committed Jun 16, 2023
1 parent 976fe2a commit 7fa1638
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions code/ui/manager/src/components/sidebar/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ const options = {

const tagsOptions = {
...options,
distance: 0,
minMatchCharLength: 2,
// useExtendedSearch: true,
keys: ['tags'],
Expand Down Expand Up @@ -212,14 +211,12 @@ export const Search = React.memo<{
if (!isTagSearchActive) {
searchResults = fuse.search(input);
} else {
const tagResults = tagsFuse.search(input).filter((obj) => {
return obj.matches.length > 0 && obj.score < 0.0001;
}) as SearchResult[];
if (input.length < 2) return [];
const tagResults = tagsFuse.search(input);

if (!tagResults[0]?.matches.length) return [];

const temp: SearchResult[] = [];
console.log(tagResults);
(tagResults as SearchResult[]).forEach(({ item }) => {
const parent = childFuse.search(`'${item.parent}$`)[0];
if (!parent) return;
Expand Down

0 comments on commit 7fa1638

Please sign in to comment.