fix empty tab issue

This commit is contained in:
Jonathan Summers-Muir committed 2024-11-22 23:09:28 +08:00
1 parent 752b8c2c9d
commit 3b28902a22
1 file changed
+4 -11
+4 -11
View File
@@ -212,16 +212,9 @@ export const handleTabClose = (
const currentTabs = Object.values(tabsStore.tabsMap).filter((tab) => tab.id !== id)
const nextTabId = currentTabs.filter((tab) => tab.type === editor)[0]?.id
// Find if there are any tabs left of the same type
const hasTabsOfSameType = currentTabs.some((tab) => {
const foundTab = tabsStore.tabsMap[tab.id]
return tab?.type === foundTab.type
})
// console.log('Current Tab:', currentTab)
// console.log('Current Tabs:', currentTabs)
// console.log('Next Tab ID:', nextTabId)
// console.log('Has Tabs of Same Type:', hasTabsOfSameType)
console.log('Current Tab:', currentTab)
console.log('Current Tabs:', currentTabs)
console.log('Next Tab ID:', nextTabId)
delete tabsStore.tabsMap[id]
if (currentTab) {
@@ -230,7 +223,7 @@ export const handleTabClose = (
tabsStore.openTabs = [...currentTabs.map((tab) => tab.id).filter((id) => id !== currentTab.id)]
}
if (!hasTabsOfSameType) {
if (!nextTabId) {
// If no tabs of same type, go to the home of the current section
switch (currentTab.type) {
case 'sql':