forked from extern/bruno
fix: fixed screen crash when collection was removed
This commit is contained in:
parent
665428a2d0
commit
487dd73040
@ -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(() => {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user