Skip to content

Commit edd7718

Browse files
committed
fix: can not switch to an open connection from connection tree view
1 parent 6e44c64 commit edd7718

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

frontend/src/components/sidebar/ConnectionTree.vue

+1
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ const openConnection = async (name) => {
295295
tabStore.upsertTab({
296296
server: name,
297297
db: browserStore.getSelectedDB(name),
298+
forceSwitch: true,
298299
})
299300
}
300301
} catch (e) {

frontend/src/stores/tab.js

+5
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ const useTabStore = defineStore('tab', {
161161
* @param {boolean} [clearValue]
162162
* @param {string} format
163163
* @param {string} decode
164+
* @param {boolean} forceSwitch
164165
* @param {*} [value]
165166
*/
166167
upsertTab({
@@ -177,6 +178,7 @@ const useTabStore = defineStore('tab', {
177178
clearValue,
178179
format = '',
179180
decode = '',
181+
forceSwitch = false,
180182
}) {
181183
let tabIndex = findIndex(this.tabList, { name: server })
182184
if (tabIndex === -1) {
@@ -221,6 +223,9 @@ const useTabStore = defineStore('tab', {
221223
if (clearValue === true) {
222224
tab.value = undefined
223225
}
226+
if (forceSwitch === true) {
227+
this._setActivatedIndex(tabIndex, true, subTab)
228+
}
224229
}
225230
},
226231

0 commit comments

Comments
 (0)