TSK-112: Fix workbench switch (#2074)

Signed-off-by: Anna No <anna.no@xored.com>
This commit is contained in:
Anna No
2022-06-15 14:31:41 +07:00
committed by GitHub
parent 619801aaca
commit b047d98189
@@ -129,9 +129,9 @@
)
async function syncLoc (loc: Location): Promise<void> {
const app = loc.path.length > 0 ? (loc.path[1] as Ref<Application>) : undefined
let space = loc.path.length > 1 ? (loc.path[2] as Ref<Space>) : undefined
let special = loc.path.length > 2 ? loc.path[3] : undefined
const app = loc.path.length > 1 ? (loc.path[1] as Ref<Application>) : undefined
let space = loc.path.length > 2 ? (loc.path[2] as Ref<Space>) : undefined
let special = loc.path.length > 3 ? loc.path[3] : undefined
if (currentApp !== app) {
clear(1)
@@ -141,7 +141,7 @@
}
if (space === undefined) {
const last = localStorage.getItem(`platform_last_loc_${currentApp}`)
const last = localStorage.getItem(`platform_last_loc_${app}`)
if (last !== null) {
const newLocation: Location = JSON.parse(last)
loc.path[2] = space = newLocation.path[2] as Ref<Space>
@@ -161,7 +161,7 @@
}
}
if (app !== undefined) {
localStorage.setItem(`platform_last_loc_${currentApp}`, JSON.stringify(loc))
localStorage.setItem(`platform_last_loc_${app}`, JSON.stringify(loc))
}
}