Skip to content

Commit f5ee159

Browse files
author
Ives van Hoorne
committed
Add tab check
1 parent 4130170 commit f5ee159

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/app/src/app/store/modules/editor/sequences.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ export const closeQuickActions = set(state`editor.quickActionsOpen`, false);
1717

1818
export const toggleProjectView = toggle(state`editor.isInProjectView`);
1919

20-
export const closeTab = [closeTabByIndex, actions.setCurrentModuleByTab];
20+
const hasEnoughTabs = when(state`editor.tabs`, tabs => tabs.length > 1);
21+
22+
export const closeTab = [
23+
hasEnoughTabs,
24+
{
25+
false: [],
26+
true: [closeTabByIndex, actions.setCurrentModuleByTab],
27+
},
28+
];
2129

2230
export const clearErrors = [
2331
set(state`editor.errors`, []),

0 commit comments

Comments
 (0)