Have you read the Contributing Guidelines on issues?
Prerequisites
Description
I'm trying to add custom search tracking to the SearchBar by extending the transformSearchClient function in docusaurus.config.ts but according to https://docusaurus.io/docs/advanced/architecture only serializable values are passed along. So that leaves me with the option to swizzle @docusaurus/theme-search-algolia.
I've swizzled @docusaurus/theme-search-algolia with the command npm run swizzle @docusaurus/theme-search-algolia and then I choose to Wrap the component. Unfortunately there is no way to pass transformSearchClient because this https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx#L315 doesn't pass props to the DocSearch component.
I think it should be possible to pass a custom transformSearchClient to a wrapped SearchBar component because that would allow for fewer breaking changes moving forward.
Reproducible demo
https://stackblitz.com/edit/github-pyvgb77t?file=src%2Ftheme%2FSearchBar%2Findex.tsx
Steps to reproduce
- add algolia search config
- swizzle @docusaurus/theme-search-algolia and choose to Wrap the component
Expected behavior
Be able to pass transformSearchClient as props to SearchBar
Actual behavior
Passed props are ignored
Your environment
- Public source code:
- Public site URL:
- Docusaurus version used:
- Environment name and version (e.g. Chrome 89, Node.js 16.4):
- Operating system and version (e.g. Ubuntu 20.04.2 LTS):
Self-service
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clearoryarn clearcommand.rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages.Description
I'm trying to add custom search tracking to the SearchBar by extending the
transformSearchClientfunction indocusaurus.config.tsbut according to https://docusaurus.io/docs/advanced/architecture only serializable values are passed along. So that leaves me with the option to swizzle @docusaurus/theme-search-algolia.I've swizzled @docusaurus/theme-search-algolia with the command
npm run swizzle @docusaurus/theme-search-algoliaand then I choose toWrapthe component. Unfortunately there is no way to passtransformSearchClientbecause this https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx#L315 doesn't pass props to theDocSearchcomponent.I think it should be possible to pass a custom
transformSearchClientto a wrappedSearchBarcomponent because that would allow for fewer breaking changes moving forward.Reproducible demo
https://stackblitz.com/edit/github-pyvgb77t?file=src%2Ftheme%2FSearchBar%2Findex.tsx
Steps to reproduce
Expected behavior
Be able to pass
transformSearchClientas props to SearchBarActual behavior
Passed props are ignored
Your environment
Self-service