diff --git a/src/hooks/useKnockoutExplorer.ts b/src/hooks/useKnockoutExplorer.ts index 430cef277..605a70e49 100644 --- a/src/hooks/useKnockoutExplorer.ts +++ b/src/hooks/useKnockoutExplorer.ts @@ -142,7 +142,7 @@ async function configureFabric(): Promise { await scheduleRefreshDatabaseResourceToken(true); resolve(explorer); await explorer.refreshAllDatabases(); - if (userContext.fabricContext.isVisible && !firstContainerOpened) { + if (userContext.fabricContext.isVisible) { firstContainerOpened = true; openFirstContainer(explorer, userContext.fabricContext.databaseConnectionInfo.databaseId); } @@ -439,6 +439,7 @@ function createExplorerFabric(params: { connectionId: string; isVisible: boolean }, }, }); + useTabs.getState().closeAllTabs(); const explorer = new Explorer(); return explorer; } diff --git a/src/hooks/useTabs.ts b/src/hooks/useTabs.ts index 001dfcf87..16835aeb4 100644 --- a/src/hooks/useTabs.ts +++ b/src/hooks/useTabs.ts @@ -42,6 +42,7 @@ export interface TabsState { selectLeftTab: () => void; selectRightTab: () => void; closeActiveTab: () => void; + closeAllTabs: () => void; persistTabsState: () => void; } @@ -237,6 +238,9 @@ export const useTabs: UseStore = create((set, get) => ({ state.closeTab(state.activeTab); } }, + closeAllTabs: () => { + set({ openedTabs: [], openedReactTabs: [], activeTab: undefined, activeReactTab: undefined }); + }, persistTabsState: () => { const state = get(); const openTabsStates = state.openedTabs.map((tab) => tab.getPersistedState());