fix: handle optional activeTab in tab activation logic (#2106)

This commit is contained in:
Vsevolod Kukol 2025-04-16 17:34:15 +00:00 committed by GitHub
parent 27c9ea7ab6
commit 00ec678569
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -115,7 +115,7 @@ export const useTabs: UseStore<TabsState> = create((set, get) => ({
set({ activeTab: undefined, activeReactTab: undefined });
}
if (tab.tabId === activeTab.tabId && tabIndex !== -1) {
if (tab.tabId === activeTab?.tabId && tabIndex !== -1) {
const tabToTheRight = updatedTabs[tabIndex];
const lastOpenTab = updatedTabs[updatedTabs.length - 1];
const newActiveTab = tabToTheRight ?? lastOpenTab;