mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-04 20:57:17 +02:00
fix(search-algolia): pass custom transformItems function to SearchBar (#8462)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com> closes undefined Closes https://github.com/facebook/docusaurus/pull/8462 Closes https://github.com/facebook/docusaurus/issues/8461
This commit is contained in:
parent
9c860ce419
commit
0985fa0af3
1 changed files with 8 additions and 4 deletions
|
@ -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'] =
|
||||
|
|
Loading…
Add table
Reference in a new issue