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 committed Dec 29, 2022
1 parent 9c860ce commit 0985fa0
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 0985fa0

Please sign in to comment.