Skip to content

Commit 12a418f

Browse files
xiaokesongxiejay97
authored andcommitted
fix(site): safari doesn't support lookbehind
1 parent 3fb6803 commit 12a418f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/site/src/app/routes/layout/Sidebar.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export function AppSidebar(props: AppSidebarProps): JSX.Element | null {
2323

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

2929
const menuNode = (
3030
<DMenu

0 commit comments

Comments
 (0)