fix: pass down withSearch from EntityTechdocsContent component

Signed-off-by: Yasser Hennawi <yahennawi@gmail.com>
This commit is contained in:
Yasser Hennawi
2025-01-03 17:08:40 +01:00
parent 41ab5cf4a0
commit 3710b3507f
3 changed files with 28 additions and 11 deletions
+11 -5
View File
@@ -57,16 +57,19 @@ export const Router = () => {
};
export const EmbeddedDocsRouter = (
props: PropsWithChildren<{ emptyState?: React.ReactElement }>,
props: PropsWithChildren<{
emptyState?: React.ReactElement;
withSearch?: boolean;
}>,
) => {
const { children, emptyState } = props;
const { children, emptyState, withSearch = true } = props;
const { entity } = useEntity();
// Using objects instead of <Route> elements, otherwise "outlet" will be null on sub-pages and add-ons won't render
const element = useRoutes([
{
path: '/*',
element: <EntityPageDocs entity={entity} />,
element: <EntityPageDocs entity={entity} withSearch={withSearch} />,
children: [
{
path: '*',
@@ -96,8 +99,11 @@ export const EmbeddedDocsRouter = (
*
* @public
*/
export const LegacyEmbeddedDocsRouter = (props: PropsWithChildren<{}>) => {
export const LegacyEmbeddedDocsRouter = ({
children,
withSearch = true,
}: PropsWithChildren<{ withSearch?: boolean }>) => {
// Wrap the Router to avoid exposing the emptyState prop in the non-alpha
// public API and make it easier for us to change later.
return <EmbeddedDocsRouter children={props.children} />;
return <EmbeddedDocsRouter children={children} withSearch={withSearch} />;
};