Skip to content

Commit

Permalink
fix: can not switch to an open connection from connection tree view
Browse files Browse the repository at this point in the history
  • Loading branch information
tiny-craft committed Jan 7, 2025
1 parent 6e44c64 commit edd7718
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions frontend/src/components/sidebar/ConnectionTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ const openConnection = async (name) => {
tabStore.upsertTab({
server: name,
db: browserStore.getSelectedDB(name),
forceSwitch: true,
})
}
} catch (e) {
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/stores/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ const useTabStore = defineStore('tab', {
* @param {boolean} [clearValue]
* @param {string} format
* @param {string} decode
* @param {boolean} forceSwitch
* @param {*} [value]
*/
upsertTab({
Expand All @@ -177,6 +178,7 @@ const useTabStore = defineStore('tab', {
clearValue,
format = '',
decode = '',
forceSwitch = false,
}) {
let tabIndex = findIndex(this.tabList, { name: server })
if (tabIndex === -1) {
Expand Down Expand Up @@ -221,6 +223,9 @@ const useTabStore = defineStore('tab', {
if (clearValue === true) {
tab.value = undefined
}
if (forceSwitch === true) {
this._setActivatedIndex(tabIndex, true, subTab)
}
}
},

Expand Down

0 comments on commit edd7718

Please sign in to comment.