This commit is contained in:
Jan Prochazka
2021-03-01 18:39:54 +01:00
parent 689eb7baa2
commit ea05ae0079

View File

@@ -1,9 +1,10 @@
import _ from 'lodash'; import _ from 'lodash';
import { currentDatabase, openedTabs } from '../stores'; import { currentDatabase, openedTabs } from '../stores';
import { getConnectionInfo } from './metadataLoaders';
let lastCurrentTab = null; let lastCurrentTab = null;
openedTabs.subscribe(value => { openedTabs.subscribe(async value => {
const newCurrentTab = (value || []).find(x => x.selected); const newCurrentTab = (value || []).find(x => x.selected);
if (newCurrentTab == lastCurrentTab) return; if (newCurrentTab == lastCurrentTab) return;
@@ -14,8 +15,9 @@ openedTabs.subscribe(value => {
database && database &&
(conid != _.get(lastCurrentTab, 'props.conid') || database != _.get(lastCurrentTab, 'props.database')) (conid != _.get(lastCurrentTab, 'props.conid') || database != _.get(lastCurrentTab, 'props.database'))
) { ) {
const connection = await getConnectionInfo({ conid });
currentDatabase.set({ currentDatabase.set({
connection: { _id: conid }, connection,
name: database, name: database,
}); });
} }