mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-12-14 00:07:01 +00:00
Close all tabs and always load first container when initializing Fabric (#2014)
Co-authored-by: Laurent Nguyen <languye@microsoft.com>
This commit is contained in:
parent
c15d1432b2
commit
ec25586a6e
@ -142,7 +142,7 @@ async function configureFabric(): Promise<Explorer> {
|
|||||||
await scheduleRefreshDatabaseResourceToken(true);
|
await scheduleRefreshDatabaseResourceToken(true);
|
||||||
resolve(explorer);
|
resolve(explorer);
|
||||||
await explorer.refreshAllDatabases();
|
await explorer.refreshAllDatabases();
|
||||||
if (userContext.fabricContext.isVisible && !firstContainerOpened) {
|
if (userContext.fabricContext.isVisible) {
|
||||||
firstContainerOpened = true;
|
firstContainerOpened = true;
|
||||||
openFirstContainer(explorer, userContext.fabricContext.databaseConnectionInfo.databaseId);
|
openFirstContainer(explorer, userContext.fabricContext.databaseConnectionInfo.databaseId);
|
||||||
}
|
}
|
||||||
@ -439,6 +439,7 @@ function createExplorerFabric(params: { connectionId: string; isVisible: boolean
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
useTabs.getState().closeAllTabs();
|
||||||
const explorer = new Explorer();
|
const explorer = new Explorer();
|
||||||
return explorer;
|
return explorer;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ export interface TabsState {
|
|||||||
selectLeftTab: () => void;
|
selectLeftTab: () => void;
|
||||||
selectRightTab: () => void;
|
selectRightTab: () => void;
|
||||||
closeActiveTab: () => void;
|
closeActiveTab: () => void;
|
||||||
|
closeAllTabs: () => void;
|
||||||
persistTabsState: () => void;
|
persistTabsState: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,6 +238,9 @@ export const useTabs: UseStore<TabsState> = create((set, get) => ({
|
|||||||
state.closeTab(state.activeTab);
|
state.closeTab(state.activeTab);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
closeAllTabs: () => {
|
||||||
|
set({ openedTabs: [], openedReactTabs: [], activeTab: undefined, activeReactTab: undefined });
|
||||||
|
},
|
||||||
persistTabsState: () => {
|
persistTabsState: () => {
|
||||||
const state = get();
|
const state = get();
|
||||||
const openTabsStates = state.openedTabs.map((tab) => tab.getPersistedState());
|
const openTabsStates = state.openedTabs.map((tab) => tab.getPersistedState());
|
||||||
|
Loading…
Reference in New Issue
Block a user