diff --git a/packages/ui/src/components/internal/Root.svelte b/packages/ui/src/components/internal/Root.svelte index ac4f6ea16a..67f19187fa 100644 --- a/packages/ui/src/components/internal/Root.svelte +++ b/packages/ui/src/components/internal/Root.svelte @@ -35,7 +35,7 @@ } if (application === undefined) { - const last = localStorage.getItem('platform_last_loc') + const last = localStorage.getItem(`platform_last_loc_${loc.path[1]}`) if (last !== null) { navigate(JSON.parse(last)) } else { diff --git a/packages/ui/src/location.ts b/packages/ui/src/location.ts index 03b2dcee48..f0533ad8e6 100644 --- a/packages/ui/src/location.ts +++ b/packages/ui/src/location.ts @@ -115,6 +115,7 @@ export function navigate (location: PlatformLocation, store = true): void { if (store) { history.pushState(null, '', url) localStorage.setItem('platform_last_loc', JSON.stringify(location)) + localStorage.setItem(`platform_last_loc_${location.path[1]}`, JSON.stringify(location)) } locationWritable.set(location) } diff --git a/plugins/login-resources/src/utils.ts b/plugins/login-resources/src/utils.ts index fe046d2b55..8fa1ac66ff 100644 --- a/plugins/login-resources/src/utils.ts +++ b/plugins/login-resources/src/utils.ts @@ -302,7 +302,12 @@ export function navigateToWorkspace (workspace: string, loginInfo?: WorkspaceLog // Json parse error could be ignored } } - navigate({ path: [workbenchId, workspace] }) + const last = localStorage.getItem(`platform_last_loc_${workspace}`) + if (last !== null) { + navigate(JSON.parse(last)) + } else { + navigate({ path: [workbenchId, workspace] }) + } } export async function checkJoined (inviteId: string): Promise<[Status, WorkspaceLoginInfo | undefined]> { diff --git a/plugins/workbench-resources/src/components/SelectWorkspaceMenu.svelte b/plugins/workbench-resources/src/components/SelectWorkspaceMenu.svelte index b6fc5d1ef6..2e8f4ffb7c 100644 --- a/plugins/workbench-resources/src/components/SelectWorkspaceMenu.svelte +++ b/plugins/workbench-resources/src/components/SelectWorkspaceMenu.svelte @@ -71,7 +71,10 @@ closePopup() closePopup() if (ws !== getCurrentLocation().path[1]) { - navigate({ path: [workbenchId, ws] }) + const last = localStorage.getItem(`platform_last_loc_${ws}`) + if (last !== null) { + navigate(JSON.parse(last)) + } else navigate({ path: [workbenchId, ws] }) } } } diff --git a/plugins/workbench-resources/src/components/Workbench.svelte b/plugins/workbench-resources/src/components/Workbench.svelte index 133fe32a47..bc1a34d2dc 100644 --- a/plugins/workbench-resources/src/components/Workbench.svelte +++ b/plugins/workbench-resources/src/components/Workbench.svelte @@ -260,6 +260,13 @@ let special = loc.path[4] const fragment = loc.fragment + if (app === undefined) { + const last = localStorage.getItem(`platform_last_loc_${loc.path[1]}`) + if (last != null) { + navigate(JSON.parse(last)) + } + } + if (currentAppAlias !== app) { clear(1) currentAppAlias = app