diff --git a/docs/src/components/LeftNav/LeftNav.js b/docs/src/components/LeftNav/LeftNav.js index daa4913927..de95f75704 100644 --- a/docs/src/components/LeftNav/LeftNav.js +++ b/docs/src/components/LeftNav/LeftNav.js @@ -10,6 +10,8 @@ const isBrowser = typeof window !== 'undefined'; const LeftNav = (props) => { const { relativePagePath, showMobile, frontmatter } = props; const navItemsList = useNavItems(relativePagePath); + const pathName = window.location.pathname; + const navItems = navItemsList.filter((item) => { if (relativePagePath.includes(MOBILE)) { return !item.hideInMobile; @@ -52,7 +54,7 @@ const LeftNav = (props) => { ele.addEventListener('scroll', setPosition(ele.scrollTop)); return () => ele.removeEventListener('scroll', setPosition(ele.scrollTop)); - }, []); + }, [pathName]); const onClickHandler = (menu) => { navigate(menu.link); @@ -82,9 +84,12 @@ const LeftNav = (props) => { } return componentName.toUpperCase(); }; - return ( -