fix: close saved tabs (#3174)

This commit is contained in:
lohit 2024-09-23 16:02:16 +05:30 committed by GitHub
parent 6e4d7a6f76
commit bebb18fc99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,6 +17,7 @@ import CloneCollectionItem from 'components/Sidebar/Collections/Collection/Colle
import NewRequest from 'components/Sidebar/NewRequest/index'; import NewRequest from 'components/Sidebar/NewRequest/index';
import CloseTabIcon from './CloseTabIcon'; import CloseTabIcon from './CloseTabIcon';
import DraftTabIcon from './DraftTabIcon'; import DraftTabIcon from './DraftTabIcon';
import { flattenItems } from 'utils/collections/index';
const RequestTab = ({ tab, collection, tabIndex, collectionRequestTabs, folderUid }) => { const RequestTab = ({ tab, collection, tabIndex, collectionRequestTabs, folderUid }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
@ -246,8 +247,9 @@ function RequestTabMenu({ onDropdownCreate, collectionRequestTabs, tabIndex, col
function handleCloseSavedTabs(event) { function handleCloseSavedTabs(event) {
event.stopPropagation(); event.stopPropagation();
const savedTabs = collection.items.filter((item) => !item.draft); const items = flattenItems(collection?.items);
const savedTabIds = savedTabs.map((item) => item.uid) || []; const savedTabs = items?.filter?.((item) => !item.draft);
const savedTabIds = savedTabs?.map((item) => item.uid) || [];
dispatch(closeTabs({ tabUids: savedTabIds })); dispatch(closeTabs({ tabUids: savedTabIds }));
} }