fix: dirty tab count incorrect when closing tabs

This commit is contained in:
nivedin
2023-09-15 13:34:59 +05:30
committed by Andrew Bastin
parent 53ec605963
commit 34220ba814

View File

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