From 34220ba814716b05c2203f3cba6cf0482bd204a1 Mon Sep 17 00:00:00 2001 From: nivedin Date: Fri, 15 Sep 2023 13:34:59 +0530 Subject: [PATCH] fix: dirty tab count incorrect when closing tabs --- packages/hoppscotch-common/src/pages/index.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/hoppscotch-common/src/pages/index.vue b/packages/hoppscotch-common/src/pages/index.vue index 21d97dd85..88f91a82a 100644 --- a/packages/hoppscotch-common/src/pages/index.vue +++ b/packages/hoppscotch-common/src/pages/index.vue @@ -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)