Skip to content

Commit 7f91d16

Browse files
committed
fix: fix a issue which default selected keys is not correct
1 parent 5c99576 commit 7f91d16

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/tushan/client/components/layout/Sidebar.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ export const Sidebar: React.FC = React.memo(() => {
2424
const { t } = useTranslation();
2525
const { dashboard } = useTushanContext();
2626

27+
const defaultSelectedKeys = [location.pathname.replace(/\/$/, '')]; // remove end path /
28+
2729
return (
2830
<Root
2931
className="sidebar"
30-
selectedKeys={[location.pathname]}
32+
selectedKeys={defaultSelectedKeys}
3133
onClickMenuItem={(path) => navigate(path)}
3234
>
3335
{dashboard !== false && (

packages/tushan/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tushan",
3-
"version": "0.3.11",
3+
"version": "0.3.12",
44
"description": "",
55
"main": "./index.ts",
66
"scripts": {

0 commit comments

Comments
 (0)