From 3c9609c0a454dccef288e26e640c3780a4041200 Mon Sep 17 00:00:00 2001 From: wfc <2146706290@qq.com> Date: Fri, 28 Feb 2025 15:09:56 +0800 Subject: [PATCH] add --- apps/web/src/app/main/layout/NavigationMenu.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/web/src/app/main/layout/NavigationMenu.tsx b/apps/web/src/app/main/layout/NavigationMenu.tsx index d7aa53f..971dfe3 100755 --- a/apps/web/src/app/main/layout/NavigationMenu.tsx +++ b/apps/web/src/app/main/layout/NavigationMenu.tsx @@ -27,8 +27,11 @@ export const NavigationMenu = () => { } }, [isAuthenticated]); - const selectedKey = - menuItems.find((item) => item.path === pathname)?.key || ""; + const selectedKey = useMemo(() => { + const normalizePath = (path: string): string => path.replace(/\/$/, ""); + return pathname === '/' ? "home" : menuItems.find((item) => normalizePath(pathname) === item.path)?.key || ""; + }, [pathname]); + return (