From 6f3076fddb36227110de85158088d867de98e4c3 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 9 Jun 2022 08:04:09 +0200 Subject: [PATCH] #294 fixed statusbar doesn't match active tab --- packages/web/src/utility/changeCurrentDbByTab.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/web/src/utility/changeCurrentDbByTab.ts b/packages/web/src/utility/changeCurrentDbByTab.ts index ca24433e4..3e4fc5714 100644 --- a/packages/web/src/utility/changeCurrentDbByTab.ts +++ b/packages/web/src/utility/changeCurrentDbByTab.ts @@ -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; });