diff options
3 files changed, 6 insertions, 4 deletions
diff --git a/packages/react-shared/src/components/nested_sidebar_menu.tsx b/packages/react-shared/src/components/nested_sidebar_menu.tsx index 14b233cd6..9933f3b38 100644 --- a/packages/react-shared/src/components/nested_sidebar_menu.tsx +++ b/packages/react-shared/src/components/nested_sidebar_menu.tsx @@ -12,7 +12,7 @@ import { VersionDropDown } from './version_drop_down'; export interface NestedSidebarMenuProps { topLevelMenu: { [topLevel: string]: string[] }; - menuSubsectionsBySection: MenuSubsectionsBySection; + menuSubsectionsBySection?: MenuSubsectionsBySection; sidebarHeader?: React.ReactNode; shouldDisplaySectionHeaders?: boolean; onMenuItemClick?: () => void; @@ -44,6 +44,7 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N shouldDisplaySectionHeaders: true, onMenuItemClick: _.noop.bind(_), shouldReformatMenuItemNames: true, + menuSubsectionsBySection: {}, }; public render(): React.ReactNode { const navigation = _.map(this.props.topLevelMenu, (menuItems: string[], sectionName: string) => { @@ -122,7 +123,10 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N return menuItems; } private _renderMenuItemSubsections(menuItemName: string): React.ReactNode { - if (_.isUndefined(this.props.menuSubsectionsBySection[menuItemName])) { + if ( + _.isUndefined(this.props.menuSubsectionsBySection) || + _.isUndefined(this.props.menuSubsectionsBySection[menuItemName]) + ) { return null; } return this._renderMenuSubsectionsBySection(menuItemName, this.props.menuSubsectionsBySection[menuItemName]); diff --git a/packages/website/ts/components/documentation/docs_content_top_bar.tsx b/packages/website/ts/components/documentation/docs_content_top_bar.tsx index 74c9022fe..b5f51e1aa 100644 --- a/packages/website/ts/components/documentation/docs_content_top_bar.tsx +++ b/packages/website/ts/components/documentation/docs_content_top_bar.tsx @@ -148,7 +148,6 @@ export class DocsContentTopBar extends React.Component<DocsContentTopBarProps, D <div className="clearfix pl1"> <NestedSidebarMenu topLevelMenu={this.props.menu} - menuSubsectionsBySection={{}} shouldDisplaySectionHeaders={true} shouldReformatMenuItemNames={false} onMenuItemClick={this._onMenuButtonClick.bind(this)} diff --git a/packages/website/ts/pages/documentation/home.tsx b/packages/website/ts/pages/documentation/home.tsx index ee118ab1e..9356c504b 100644 --- a/packages/website/ts/pages/documentation/home.tsx +++ b/packages/website/ts/pages/documentation/home.tsx @@ -360,7 +360,6 @@ export class Home extends React.Component<HomeProps, HomeState> { > <NestedSidebarMenu topLevelMenu={topLevelMenu} - menuSubsectionsBySection={{}} shouldDisplaySectionHeaders={true} shouldReformatMenuItemNames={false} /> |