mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-05-13 20:05:57 +01: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:
parent
f968f57543
commit
6ebf19c0c9
@ -69,7 +69,11 @@ export const useTabs: UseStore<TabsState> = create((set, get) => ({
|
|||||||
if (tab.tabId === activeTab.tabId && tabIndex !== -1) {
|
if (tab.tabId === activeTab.tabId && tabIndex !== -1) {
|
||||||
const tabToTheRight = updatedTabs[tabIndex];
|
const tabToTheRight = updatedTabs[tabIndex];
|
||||||
const lastOpenTab = updatedTabs[updatedTabs.length - 1];
|
const lastOpenTab = updatedTabs[updatedTabs.length - 1];
|
||||||
set({ activeTab: tabToTheRight || lastOpenTab });
|
const newActiveTab = tabToTheRight ?? lastOpenTab;
|
||||||
|
set({ activeTab: newActiveTab });
|
||||||
|
if (newActiveTab) {
|
||||||
|
newActiveTab.onActivate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set({ openedTabs: updatedTabs });
|
set({ openedTabs: updatedTabs });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user