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
|
collectionAddEnvFileEvent as _collectionAddEnvFileEvent
|
||||||
} from './index';
|
} from './index';
|
||||||
|
|
||||||
import { closeTabs } from 'providers/ReduxStore/slices/tabs';
|
import { closeAllCollectionTabs } from 'providers/ReduxStore/slices/tabs';
|
||||||
import { isLocalCollection, resolveRequestFilename } from 'utils/common/platform';
|
import { resolveRequestFilename } from 'utils/common/platform';
|
||||||
|
|
||||||
const PATH_SEPARATOR = path.sep;
|
const PATH_SEPARATOR = path.sep;
|
||||||
|
|
||||||
@ -723,11 +723,7 @@ export const removeCollection = (collectionUid) => (dispatch, getState) => {
|
|||||||
ipcRenderer
|
ipcRenderer
|
||||||
.invoke('renderer:remove-collection', collection.pathname)
|
.invoke('renderer:remove-collection', collection.pathname)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
dispatch(
|
dispatch(closeAllCollectionTabs({ collectionUid }));
|
||||||
closeTabs({
|
|
||||||
tabUids: recursivelyGetAllItemUids(collection.items)
|
|
||||||
})
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.then(waitForNextTick)
|
.then(waitForNextTick)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -92,11 +92,23 @@ export const tabsSlice = createSlice({
|
|||||||
if (!state.tabs || !state.tabs.length) {
|
if (!state.tabs || !state.tabs.length) {
|
||||||
state.activeTabUid = null;
|
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 } =
|
export const {
|
||||||
tabsSlice.actions;
|
addTab,
|
||||||
|
focusTab,
|
||||||
|
updateRequestPaneTabWidth,
|
||||||
|
updateRequestPaneTab,
|
||||||
|
updateResponsePaneTab,
|
||||||
|
closeTabs,
|
||||||
|
closeAllCollectionTabs
|
||||||
|
} = tabsSlice.actions;
|
||||||
|
|
||||||
export default tabsSlice.reducer;
|
export default tabsSlice.reducer;
|
||||||
|
Loading…
Reference in New Issue
Block a user