Skip to content

Commit

Permalink
fix(search-algolia): pass custom transformItems function to SearchBar (
Browse files Browse the repository at this point in the history
…#8462)

Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
closes undefined
Closes #8462
Closes #8461
  • Loading branch information
mturoci authored and slorber committed Jan 26, 2023
1 parent 266209f commit 30573dd
Showing 1 changed file with 8 additions and 4 deletions.
Expand Up @@ -174,10 +174,14 @@ function DocSearch({

const transformItems = useRef<DocSearchModalProps['transformItems']>(
(items) =>
items.map((item) => ({
...item,
url: processSearchResultUrl(item.url),
})),
props.transformItems
? // Custom transformItems
props.transformItems(items)
: // Default transformItems
items.map((item) => ({
...item,
url: processSearchResultUrl(item.url),
})),
).current;

const resultsFooterComponent: DocSearchProps['resultsFooterComponent'] =
Expand Down

0 comments on commit 30573dd

Please sign in to comment.