Skip to content

Commit

Permalink
fix: fix nested sidebar links (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
vi-nastya authored Apr 7, 2021
1 parent b1161f0 commit 7d88bf4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/layouts/doc-layout/doc-layout.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,13 @@ const SidebarNode = (props) => {
const [isActive, setIsActive] = useState(false);

useEffect(() => {
// need to encode URI to correctly compare Spanish special characters
const maybePrefixedPath = encodeURI(withPrefix(meta.path));
const maybePrefixedPath = withPrefix(meta.path);
const doesPathMatchLocation =
maybePrefixedPath === window.location.pathname;
const isPathLocationPart =
meta.path === '/' || meta.path === '/es'
? false
: window.location.pathname.startsWith(`${maybePrefixedPath}/`) ||
: window.location.pathname.startsWith(`${maybePrefixedPath}`) ||
window.location.pathname.startsWith(
`${maybePrefixedPath
.split('/')
Expand Down

0 comments on commit 7d88bf4

Please sign in to comment.