Skip to content

Commit

Permalink
fix: some problems with properties and data tabs when changing databa…
Browse files Browse the repository at this point in the history
…se from sidebar
  • Loading branch information
Fabio286 committed Nov 18, 2020
1 parent db577bf commit 0fe7157
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/renderer/components/Workspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ export default {
return this.selectedWorkspace === this.connection.uid;
},
selectedTab () {
return this.queryTabs.find(tab => tab.uid === this.workspace.selected_tab) || ['data', 'prop'].includes(this.workspace.selected_tab) ? this.workspace.selected_tab : this.queryTabs[0].uid;
if (this.workspace.breadcrumbs.table === null)
return this.queryTabs[0].uid;
return this.queryTabs.find(tab => tab.uid === this.workspace.selected_tab) ||
['data', 'prop'].includes(this.workspace.selected_tab)
? this.workspace.selected_tab
: this.queryTabs[0].uid;
},
queryTabs () {
return this.workspace.tabs.filter(tab => tab.type === 'query');
Expand Down
9 changes: 5 additions & 4 deletions src/renderer/store/modules/workspaces.store.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Connection from '@/ipc-api/Connection';
import Database from '@/ipc-api/Database';
import { uidGen } from 'common/libs/uidGen';
const tabIndex = [];
let lastSchema = '';
let lastBreadcrumb = '';

export default {
namespaced: true,
Expand Down Expand Up @@ -291,12 +291,13 @@ export default {
dispatch('newTab', uid);
},
changeBreadcrumbs ({ commit, getters }, payload) {
if (lastSchema !== payload.schema) {
if (lastBreadcrumb.schema === payload.schema && lastBreadcrumb.table !== null && payload.table === null) return;

if (lastBreadcrumb.schema !== payload.schema)
Database.useSchema({ uid: getters.getSelected, schema: payload.schema });
lastSchema = payload.schema;
}

commit('CHANGE_BREADCRUMBS', { uid: getters.getSelected, breadcrumbs: payload });
lastBreadcrumb = { ...payload };
},
newTab ({ commit }, uid) {
commit('NEW_TAB', uid);
Expand Down

0 comments on commit 0fe7157

Please sign in to comment.