Skip to content

Commit

Permalink
fix(docz): remove deduplicated search results (thanks @ivan-dalmet)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Feb 19, 2019
1 parent c8522ff commit 1b456f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/docz/src/hooks/useMenus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ const sortMenus = (first: Menus, second: Menus | undefined = []): Menus => {
const search = (val: string, menu: MenuItem[]) => {
const items = menu.map(item => [item].concat(item.menu || []))
const flattened = flattenDepth(2, items)
return match(flattened, val, { keys: ['name'] })
const flattenedDeduplicated = [...new Set(flattened)]
return match(flattenedDeduplicated, val, { keys: ['name'] })
}

export interface UseMenusParams {
Expand Down

0 comments on commit 1b456f7

Please sign in to comment.