Compare commits

...

2 Commits

Author SHA1 Message Date
amk-dev
a9814a6bce refactor: make the calculation more expressive 2023-09-18 11:16:24 +05:30
nivedin
34220ba814 fix: dirty tab count incorrect when closing tabs 2023-09-18 11:16:24 +05:30

View File

@@ -229,11 +229,14 @@ const removeTab = (tabID: string) => {
} }
const closeOtherTabsAction = (tabID: string) => { const closeOtherTabsAction = (tabID: string) => {
const isTabDirty = getTabRef(tabID).value?.document.isDirty
const dirtyTabCount = getDirtyTabsCount() const dirtyTabCount = getDirtyTabsCount()
// If current tab is dirty, so we need to subtract 1 from the dirty tab count
const balanceDirtyTabCount = isTabDirty ? dirtyTabCount - 1 : dirtyTabCount
// If there are dirty tabs, show the confirm modal // If there are dirty tabs, show the confirm modal
if (dirtyTabCount > 0) { if (balanceDirtyTabCount > 0) {
confirmingCloseAllTabs.value = true confirmingCloseAllTabs.value = true
unsavedTabsCount.value = dirtyTabCount unsavedTabsCount.value = balanceDirtyTabCount
exceptedTabID.value = tabID exceptedTabID.value = tabID
} else { } else {
closeOtherTabs(tabID) closeOtherTabs(tabID)