Fix select workspace when open workspace in new tab (#5545)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2024-05-08 22:20:00 +05:00 committed by GitHub
parent b27b88bc04
commit 2c3ffba681
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -310,7 +310,7 @@ export async function selectWorkspace (workspace: string): Promise<[Status, Work
}
}
const token = getMetadata(presentation.metadata.Token)
const token = getMetadata(presentation.metadata.Token) ?? fetchMetadataLocalStorage(login.metadata.LastToken)
if (token === undefined) {
const loc = getCurrentLocation()
loc.path[0] = 'login'

View File

@ -67,7 +67,11 @@ export async function connect (title: string): Promise<Client | undefined> {
const tokens: Record<string, string> = fetchMetadataLocalStorage(login.metadata.LoginTokens) ?? {}
let token = tokens[ws]
if (token === undefined && getMetadata(presentation.metadata.Token) !== undefined) {
if (
token === undefined &&
(getMetadata(presentation.metadata.Token) !== undefined ||
fetchMetadataLocalStorage(login.metadata.LastToken) != null)
) {
const selectWorkspace = await getResource(login.function.SelectWorkspace)
const loginInfo = await ctx.with('select-workspace', {}, async () => (await selectWorkspace(ws))[1])
if (loginInfo !== undefined) {