From 7048e9c3a33adab58b24f86871e7e175f87ebd08 Mon Sep 17 00:00:00 2001 From: SuZhou-Joe Date: Mon, 8 Apr 2024 10:26:11 +0800 Subject: [PATCH] fix: page not found error Signed-off-by: SuZhou-Joe --- .../application/application_service.tsx | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/core/public/application/application_service.tsx b/src/core/public/application/application_service.tsx index f79922d1926e..d072ddd7827a 100644 --- a/src/core/public/application/application_service.tsx +++ b/src/core/public/application/application_service.tsx @@ -260,18 +260,23 @@ export class ApplicationService { const currentAppId = this.currentAppId$.value; const navigatingToSameApp = currentAppId === appId; const shouldNavigate = navigatingToSameApp ? true : await this.shouldNavigate(overlays); - const targetApp = applications$.value.get(appId); - if ( - workspaces.currentWorkspaceId$.value && - targetApp?.visibility === AppVisibility.homeOnly - ) { - // If user is inside a workspace and the target app is homeOnly - // refresh the page by doing a hard navigation - window.location.assign(getAppUrl(availableMounters, appId, path)); - return; - } if (shouldNavigate) { + const targetApp = applications$.value.get(appId); + if ( + workspaces.currentWorkspaceId$.value && + targetApp?.visibility === AppVisibility.homeOnly + ) { + // If user is inside a workspace and the target app is homeOnly + // refresh the page by doing a hard navigation + window.location.assign( + http.basePath.prepend(getAppUrl(availableMounters, appId, path), { + withoutClientBasePath: true, + }) + ); + return; + } + if (path === undefined) { path = applications$.value.get(appId)?.defaultPath; }