diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js index d0b3d62f..8cdfb03c 100644 --- a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js +++ b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js @@ -42,8 +42,8 @@ import { collectionAddEnvFileEvent as _collectionAddEnvFileEvent } from './index'; -import { closeTabs } from 'providers/ReduxStore/slices/tabs'; -import { isLocalCollection, resolveRequestFilename } from 'utils/common/platform'; +import { closeAllCollectionTabs } from 'providers/ReduxStore/slices/tabs'; +import { resolveRequestFilename } from 'utils/common/platform'; const PATH_SEPARATOR = path.sep; @@ -723,11 +723,7 @@ export const removeCollection = (collectionUid) => (dispatch, getState) => { ipcRenderer .invoke('renderer:remove-collection', collection.pathname) .then(() => { - dispatch( - closeTabs({ - tabUids: recursivelyGetAllItemUids(collection.items) - }) - ); + dispatch(closeAllCollectionTabs({ collectionUid })); }) .then(waitForNextTick) .then(() => { diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/tabs.js b/packages/bruno-app/src/providers/ReduxStore/slices/tabs.js index 4f8778a5..ab575a2f 100644 --- a/packages/bruno-app/src/providers/ReduxStore/slices/tabs.js +++ b/packages/bruno-app/src/providers/ReduxStore/slices/tabs.js @@ -92,11 +92,23 @@ export const tabsSlice = createSlice({ if (!state.tabs || !state.tabs.length) { state.activeTabUid = null; } + }, + closeAllCollectionTabs: (state, action) => { + const collectionUid = action.payload.collectionUid; + state.tabs = filter(state.tabs, (t) => t.collectionUid !== collectionUid); + state.activeTabUid = null; } } }); -export const { addTab, focusTab, updateRequestPaneTabWidth, updateRequestPaneTab, updateResponsePaneTab, closeTabs } = - tabsSlice.actions; +export const { + addTab, + focusTab, + updateRequestPaneTabWidth, + updateRequestPaneTab, + updateResponsePaneTab, + closeTabs, + closeAllCollectionTabs +} = tabsSlice.actions; export default tabsSlice.reducer;