mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-19 08:51:24 +00:00
fix: Activate the last opened React tab after closing active tab (#2156)
This commit is contained in:
@@ -103,7 +103,7 @@ export const useTabs: UseStore<TabsState> = create((set, get) => ({
|
||||
.forEach((tab) => tab.onCloseTabButtonClick()),
|
||||
closeTab: (tab: TabsBase): void => {
|
||||
let tabIndex: number;
|
||||
const { activeTab, openedTabs } = get();
|
||||
const { activeTab, openedTabs, openedReactTabs } = get();
|
||||
const updatedTabs = openedTabs.filter((openedTab, index) => {
|
||||
if (tab.tabId === openedTab.tabId) {
|
||||
tabIndex = index;
|
||||
@@ -127,6 +127,10 @@ export const useTabs: UseStore<TabsState> = create((set, get) => ({
|
||||
|
||||
set({ openedTabs: updatedTabs });
|
||||
|
||||
if (updatedTabs.length === 0 && openedReactTabs.length > 0) {
|
||||
set({ activeTab: undefined, activeReactTab: openedReactTabs[openedReactTabs.length - 1] });
|
||||
}
|
||||
|
||||
get().persistTabsState();
|
||||
},
|
||||
closeAllNotebookTabs: (hardClose): void => {
|
||||
|
||||
Reference in New Issue
Block a user