Skip to content

Commit

Permalink
fix(site): safari doesn't support lookbehind
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaokesong authored and xiejay97 committed Mar 5, 2023
1 parent 3fb6803 commit 12a418f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/site/src/app/routes/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export function AppSidebar(props: AppSidebarProps): JSX.Element | null {

const location = useLocation();
const page = location.pathname.startsWith('/docs') ? 'Docs' : location.pathname.startsWith('/components') ? 'Components' : null;
const regex = new RegExp(String.raw`(?<=^\/${page === 'Docs' ? 'docs' : 'components'}\/).+$`);
const activeId = location.pathname.match(regex)?.[0] ?? null;
const regex = new RegExp(String.raw`^\/${page === 'Docs' ? 'docs' : 'components'}\/(.+$)`);
const activeId = location.pathname.match(regex)?.[1] ?? null;

const menuNode = (
<DMenu
Expand Down

0 comments on commit 12a418f

Please sign in to comment.