From 9e8112a4e56ecee29e49126d01f9d56dfeeafc37 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Wed, 1 May 2024 16:23:30 +0530 Subject: [PATCH] fix: make close all tabs action account for tabs with invalid request handles --- .../hoppscotch-common/src/services/tab/rest.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/hoppscotch-common/src/services/tab/rest.ts b/packages/hoppscotch-common/src/services/tab/rest.ts index cd3a93e0f..4fb2ef612 100644 --- a/packages/hoppscotch-common/src/services/tab/rest.ts +++ b/packages/hoppscotch-common/src/services/tab/rest.ts @@ -86,7 +86,22 @@ export class RESTTabService extends TabService { let count = 0 for (const tab of this.tabMap.values()) { - if (tab.document.isDirty) count++ + if (tab.document.isDirty) { + count++ + return + } + + if ( + tab.document.saveContext?.originLocation === "workspace-user-collection" + ) { + const requestHandle = tab.document.saveContext.requestHandle as + | HandleRef["value"] + | undefined + + if (requestHandle?.type === "invalid") { + count++ + } + } } return count