From bebb18fc9906a387ad4cb080f4eb881944738560 Mon Sep 17 00:00:00 2001 From: lohit Date: Mon, 23 Sep 2024 16:02:16 +0530 Subject: [PATCH] fix: close saved tabs (#3174) --- .../src/components/RequestTabs/RequestTab/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/bruno-app/src/components/RequestTabs/RequestTab/index.js b/packages/bruno-app/src/components/RequestTabs/RequestTab/index.js index f03cd8779..e73313c13 100644 --- a/packages/bruno-app/src/components/RequestTabs/RequestTab/index.js +++ b/packages/bruno-app/src/components/RequestTabs/RequestTab/index.js @@ -17,6 +17,7 @@ import CloneCollectionItem from 'components/Sidebar/Collections/Collection/Colle import NewRequest from 'components/Sidebar/NewRequest/index'; import CloseTabIcon from './CloseTabIcon'; import DraftTabIcon from './DraftTabIcon'; +import { flattenItems } from 'utils/collections/index'; const RequestTab = ({ tab, collection, tabIndex, collectionRequestTabs, folderUid }) => { const dispatch = useDispatch(); @@ -246,8 +247,9 @@ function RequestTabMenu({ onDropdownCreate, collectionRequestTabs, tabIndex, col function handleCloseSavedTabs(event) { event.stopPropagation(); - const savedTabs = collection.items.filter((item) => !item.draft); - const savedTabIds = savedTabs.map((item) => item.uid) || []; + const items = flattenItems(collection?.items); + const savedTabs = items?.filter?.((item) => !item.draft); + const savedTabIds = savedTabs?.map((item) => item.uid) || []; dispatch(closeTabs({ tabUids: savedTabIds })); }