#294 fixed statusbar doesn't match active tab

This commit is contained in:
Jan Prochazka
2022-06-09 08:04:09 +02:00
parent 92c336624a
commit 6f3076fddb

View File

@@ -8,14 +8,17 @@ let lastCurrentTab = null;
openedTabs.subscribe(value => {
const newCurrentTab = (value || []).find(x => x.selected);
if (newCurrentTab == lastCurrentTab) return;
if (lastCurrentTab?.tabComponent == 'ConnectionTab') return;
const lastTab = lastCurrentTab;
lastCurrentTab = newCurrentTab;
if (lastTab?.tabComponent == 'ConnectionTab') return;
if (newCurrentTab) {
const { conid, database } = newCurrentTab.props || {};
if (
conid &&
database &&
(conid != _.get(lastCurrentTab, 'props.conid') || database != _.get(lastCurrentTab, 'props.database'))
(conid != _.get(lastTab, 'props.conid') || database != _.get(lastTab, 'props.database'))
) {
const doWork = async () => {
const connection = await getConnectionInfo({ conid });
@@ -27,6 +30,4 @@ openedTabs.subscribe(value => {
callWhenAppLoaded(doWork);
}
}
lastCurrentTab = newCurrentTab;
});