From 0b00c7bf0657b725bb128868443c4b0f6ebb7e43 Mon Sep 17 00:00:00 2001 From: invalid w Date: Fri, 5 Jul 2024 18:32:53 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E6=9F=A5=E6=89=BE?= =?UTF-8?q?=E6=A0=B9=E8=8F=9C=E5=8D=95=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/@core/forward/helpers/src/find-menu-by-path.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/@core/forward/helpers/src/find-menu-by-path.ts b/packages/@core/forward/helpers/src/find-menu-by-path.ts index 29813a9e..1c69e622 100644 --- a/packages/@core/forward/helpers/src/find-menu-by-path.ts +++ b/packages/@core/forward/helpers/src/find-menu-by-path.ts @@ -24,7 +24,9 @@ function findMenuByPath( function findRootMenuByPath(menus: MenuRecordRaw[], path?: string) { const findMenu = findMenuByPath(menus, path); const rootMenuPath = findMenu?.parents?.[0]; - const rootMenu = menus.find((item) => item.path === rootMenuPath); + const rootMenu = rootMenuPath + ? menus.find((item) => item.path === rootMenuPath) + : undefined; return { findMenu, rootMenu,