From 76d106e4742d6f1f260988285711be9d32390811 Mon Sep 17 00:00:00 2001 From: zhang Date: Mon, 2 Jun 2025 08:07:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=20When=20defaultHomePage=20is=20inconsi?= =?UTF-8?q?stent=20with=20user.homePath,=20the=20pa=E2=80=A6=20(#6299)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: When defaultHomePage is inconsistent with user.homePath, the page refresh route jump will be abnormal * fix: When defaultHomePage is inconsistent with user.homePath, the page refresh route jump will be abnormal --- playground/src/router/guard.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/playground/src/router/guard.ts b/playground/src/router/guard.ts index 3bbe8dca..514bd2eb 100644 --- a/playground/src/router/guard.ts +++ b/playground/src/router/guard.ts @@ -105,11 +105,16 @@ function setupAccessGuard(router: Router) { accessStore.setAccessMenus(accessibleMenus); accessStore.setAccessRoutes(accessibleRoutes); accessStore.setIsAccessChecked(true); - const redirectPath = (from.query.redirect ?? - (to.path === preferences.app.defaultHomePath - ? userInfo.homePath || preferences.app.defaultHomePath - : to.fullPath)) as string; - + let redirectPath: string; + if (from.query.redirect) { + redirectPath = from.query.redirect as string; + } else if (to.path === preferences.app.defaultHomePath) { + redirectPath = preferences.app.defaultHomePath; + } else if (userInfo.homePath && to.path === userInfo.homePath) { + redirectPath = userInfo.homePath; + } else { + redirectPath = to.fullPath; + } return { ...router.resolve(decodeURIComponent(redirectPath)), replace: true,