mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-19 00:41:31 +00:00
Close tab fixes (#1107)
* Close tab fixes Ensure that when promoting a new tab to being the 'active' tab (as a consequence of, say, closing the active tab) that the newly promoted tab has a chance to install its buttons and what not. * Set new active tab even if undefined
This commit is contained in:
@@ -69,7 +69,11 @@ export const useTabs: UseStore<TabsState> = create((set, get) => ({
|
||||
if (tab.tabId === activeTab.tabId && tabIndex !== -1) {
|
||||
const tabToTheRight = updatedTabs[tabIndex];
|
||||
const lastOpenTab = updatedTabs[updatedTabs.length - 1];
|
||||
set({ activeTab: tabToTheRight || lastOpenTab });
|
||||
const newActiveTab = tabToTheRight ?? lastOpenTab;
|
||||
set({ activeTab: newActiveTab });
|
||||
if (newActiveTab) {
|
||||
newActiveTab.onActivate();
|
||||
}
|
||||
}
|
||||
|
||||
set({ openedTabs: updatedTabs });
|
||||
|
||||
Reference in New Issue
Block a user