Skip to content

Commit

Permalink
fix: search works again
Browse files Browse the repository at this point in the history
  • Loading branch information
Cayla Hamann committed Jul 16, 2020
1 parent 2c9a6a1 commit ac7a0aa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/NavigationItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ const NavItem = ({ page, depthLevel, searchTerm, filteredPageNames }) => {
const isExpanded = overviewIsExpanded || toggleIsExpanded;

useEffect(() => {
if (filteredPageNames?.includes(page.displayName)) {
setToggleIsExpanded(true);
setOverviewIsExpanded(true);
}
if (page.displayName !== 'Component library') {
setOverviewIsExpanded(isHomePage || crumbs.includes(page.displayName));
}
Expand All @@ -105,7 +109,7 @@ const NavItem = ({ page, depthLevel, searchTerm, filteredPageNames }) => {
setToggleIsExpanded(false);
setOverviewIsExpanded(false);
}
}, [isHomePage, page.displayName, prevCrumbs, crumbs]);
}, [isHomePage, page.displayName, prevCrumbs, crumbs, filteredPageNames]);

const isCurrentPage = crumbs[crumbs.length - 1] === page.displayName;
const isBreadCrumb = crumbs.includes(page.displayName);
Expand Down

0 comments on commit ac7a0aa

Please sign in to comment.