fix: can not switch to an open connection from connection tree view

This commit is contained in:
Lykin 2025-01-07 16:24:12 +08:00
parent 6e44c64441
commit edd77182a5
2 changed files with 6 additions and 0 deletions

View File

@ -295,6 +295,7 @@ const openConnection = async (name) => {
tabStore.upsertTab({
server: name,
db: browserStore.getSelectedDB(name),
forceSwitch: true,
})
}
} catch (e) {

View File

@ -161,6 +161,7 @@ const useTabStore = defineStore('tab', {
* @param {boolean} [clearValue]
* @param {string} format
* @param {string} decode
* @param {boolean} forceSwitch
* @param {*} [value]
*/
upsertTab({
@ -177,6 +178,7 @@ const useTabStore = defineStore('tab', {
clearValue,
format = '',
decode = '',
forceSwitch = false,
}) {
let tabIndex = findIndex(this.tabList, { name: server })
if (tabIndex === -1) {
@ -221,6 +223,9 @@ const useTabStore = defineStore('tab', {
if (clearValue === true) {
tab.value = undefined
}
if (forceSwitch === true) {
this._setActivatedIndex(tabIndex, true, subTab)
}
}
},