fix(docsearch): hoist transformItems default value
This fixes a bug where the `transformItems` function reference changes and the `autocomplete` instance is recreated every time.
This commit is contained in:
parent
07932127ad
commit
1b9952fa9d
1 changed files with 5 additions and 1 deletions
|
|
@ -27,6 +27,10 @@ interface DocSearchModalProps extends DocSearchProps {
|
|||
onClose?(): void;
|
||||
}
|
||||
|
||||
function defaultTransformItems(x: DocSearchHit[]) {
|
||||
return x;
|
||||
}
|
||||
|
||||
export function DocSearchModal({
|
||||
appId = 'BH4D9OD16A',
|
||||
apiKey,
|
||||
|
|
@ -34,7 +38,7 @@ export function DocSearchModal({
|
|||
placeholder = 'Search docs',
|
||||
searchParameters,
|
||||
onClose = noop,
|
||||
transformItems = (x) => x,
|
||||
transformItems = defaultTransformItems,
|
||||
hitComponent = Hit,
|
||||
resultsFooterComponent = () => null,
|
||||
navigator,
|
||||
|
|
|
|||
Loading…
Reference in a new issue